Skip to content

Commit

Permalink
fix: check the max is number
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby committed Sep 9, 2024
1 parent b191501 commit 967e995
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion react/src/components/InputNumberWithSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ const InputNumberWithSlider: React.FC<InputNumberWithSliderProps> = ({
onChange={setValue}
onBlur={() => {
if (_.isNumber(step) && step > 0) {
if (max && max < _.toNumber(inputRef.current?.value || '0')) {
if (
_.isNumber(max) &&
max < _.toNumber(inputRef.current?.value || '0')
) {
return; // do not update value if it is greater than max
}
const decimalCount = step.toString().split('.')[1]?.length || 0;
Expand Down

0 comments on commit 967e995

Please sign in to comment.