Skip to content

Commit

Permalink
clamp initialValue
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Jul 20, 2022
1 parent e9e64e0 commit d193482
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/components/src/range-control/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export function useControlledRangeValue(
const { min, max, value: valueProp, initial } = settings;
const [ state, setInternalState ] = useControlledState(
floatClamp( valueProp, min, max ),
{ initial, fallback: null }
{
initial: floatClamp( initial ?? null, min, max ),
fallback: null,
}
);

const setState = useCallback(
Expand Down

0 comments on commit d193482

Please sign in to comment.