You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
issue: Controlled Field Array Controller component does not render latest value with update(index, { ...item, lastName: "World", }); if using spread operator {...item, lastName: "World"} to update an object
#12017
Create a form with the controlledFields, Controller component and a button to call update method returned from useFieldArray with obj param like {...item, lastName: "World"}
Currently, calling update method like update(index, { ...item, lastName: "World", }); to update an object when using Controlled Field Array and register method from useForm is able to render updated value.
However, Controller component cannot render updated value as render props is not updated.
It is expected that Controller component should render the updated value same as register method when calling update method like update(index, { ...item, lastName: "World", });
This discussion was converted from issue #12008 on June 15, 2024 10:20.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7.51.5
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/sparkling-sound-33tjcv?file=%2Fsrc%2FApp.js
Steps to reproduce
Expected behaviour
Currently, calling update method like
update(index, { ...item, lastName: "World", });
to update an object when using Controlled Field Array and register method from useForm is able to render updated value.However, Controller component cannot render updated value as render props is not updated.
It is expected that Controller component should render the updated value same as register method when calling update method like
update(index, { ...item, lastName: "World", })
;What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions