We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 731457b commit 76a4c5bCopy full SHA for 76a4c5b
src/components/Form/NumberRecordField.tsx
@@ -27,13 +27,19 @@ export const NumberRecordField = <T extends NumberRecordFieldValue = NumberRecor
27
setValue: setRecordValue,
28
value: recordValue
29
}: NumberRecordFieldProps<T>) => {
30
- const isFirstRenderRef = useRef(true);
+ const optionsRef = useRef(options);
31
32
useEffect(() => {
33
- if ((isFirstRenderRef.current && !recordValue) || !isFirstRenderRef.current) {
+ if (!recordValue) {
34
setRecordValue({});
35
}
36
- isFirstRenderRef.current = false;
+ }, []);
37
+
38
+ useEffect(() => {
39
+ if (optionsRef.current !== options) {
40
+ setRecordValue({});
41
+ optionsRef.current = options;
42
+ }
43
}, [options]);
44
45
if (!recordValue) {
0 commit comments