Skip to content

Commit

Permalink
Merge pull request #17247 from aritrakoley/number_counter_issue
Browse files Browse the repository at this point in the history
Controls: Fix number control update when using useArgs hook
  • Loading branch information
shilman committed Jan 17, 2022
2 parents 2f83d1b + 4e6dfb4 commit ad15e4c
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 ad15e4c

Please sign in to comment.