Prerequisites
What theme are you using?
core
Version
6.4.2
Current Behavior
When two additional property keys are renamed in quick succession (before React re-renders between them), the first rename's result is silently dropped and the property disappears from the form.
Expected Behavior
Both renamed properties should remain visible in the form after sequential renames.
Steps To Reproduce
- Open the playground and select the "Additional Properties" example
- Click "Add Item" (creates a
newKey property)
- Rename
newKey to second, press Tab
- Immediately click the
assKickCount key input, type renamed, press Tab
- The
second property disappears from the form
Environment
- OS: macOS
- Node: 22
- npm: 10
Anything else?
handleKeyRename in ObjectField.tsx captures formData via useCallback and computes the entire new formData object from that snapshot. When two renames fire before React flushes the batched state update from the first rename, the second rename reads stale formData that doesn't include the first rename's result.
The pendingChanges queue in Form.tsx serializes the application of changes, but the payload is already computed from stale data before being enqueued — so the queue can't recover the lost property.
A possible fix is to use a ref to always read the latest formData inside the callback:
const formDataRef = useRef(formData);
formDataRef.current = formData;
Then read formDataRef.current inside handleKeyRename instead of the closure variable.
Prerequisites
What theme are you using?
core
Version
6.4.2
Current Behavior
When two additional property keys are renamed in quick succession (before React re-renders between them), the first rename's result is silently dropped and the property disappears from the form.
Expected Behavior
Both renamed properties should remain visible in the form after sequential renames.
Steps To Reproduce
newKeyproperty)newKeytosecond, press TabassKickCountkey input, typerenamed, press Tabsecondproperty disappears from the formEnvironment
Anything else?
handleKeyRenameinObjectField.tsxcapturesformDataviauseCallbackand computes the entire new formData object from that snapshot. When two renames fire before React flushes the batched state update from the first rename, the second rename reads staleformDatathat doesn't include the first rename's result.The
pendingChangesqueue inForm.tsxserializes the application of changes, but the payload is already computed from stale data before being enqueued — so the queue can't recover the lost property.A possible fix is to use a ref to always read the latest formData inside the callback:
Then read
formDataRef.currentinsidehandleKeyRenameinstead of the closure variable.