Skip to content

Commit

Permalink
Fix Issue #15924 (Number control does not update when using useArgs h…
Browse files Browse the repository at this point in the history
…ook)
  • Loading branch information
aritrakoley committed Jan 15, 2022
1 parent 8982726 commit 4e6dfb4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/components/src/controls/Number.tsx
Expand Up @@ -58,6 +58,13 @@ export const NumberControl: FC<NumberProps> = ({
if (forceVisible && htmlElRef.current) htmlElRef.current.select();
}, [forceVisible]);

useEffect(() => {
const newInputValue = typeof value === 'number' ? value : '';
if (inputValue !== newInputValue) {
setInputValue(value);
}
}, [value]);

if (!forceVisible && value === undefined) {
return (
<Form.Button id={getControlSetterButtonId(name)} onClick={onForceVisible}>
Expand Down

0 comments on commit 4e6dfb4

Please sign in to comment.