File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -478,7 +478,20 @@ export const Field = (<
478
478
const fieldApi = useField ( fieldOptions as any )
479
479
480
480
const jsxToDisplay = useMemo (
481
- ( ) => functionalUpdate ( children , fieldApi as any ) ,
481
+ ( ) => {
482
+ /**
483
+ * When field names switch field store and form store are out of sync.
484
+ * When in this state, React should not render the component
485
+ */
486
+ const isFieldStoreOutofSync =
487
+ fieldApi . state . value !== fieldApi . form . getFieldValue ( fieldOptions . name )
488
+
489
+ if ( isFieldStoreOutofSync ) {
490
+ return null
491
+ }
492
+
493
+ return functionalUpdate ( children , fieldApi as any )
494
+ } ,
482
495
/**
483
496
* The reason this exists is to fix an issue with the React Compiler.
484
497
* Namely, functionalUpdate is memoized where it checks for `fieldApi`, which is a static type.
You can’t perform that action at this time.
0 commit comments