update
method for useFieldArray
#5832
Replies: 10 comments 8 replies
-
Being able to update an individual field array node using its index will be very useful to me (and presumably many others). Thank you! |
Beta Was this translation helpful? Give feedback.
-
It's a huge yes for me. I'm looking forward to it. Btw, there's a missing |
Beta Was this translation helpful? Give feedback.
-
This is great. I use |
Beta Was this translation helpful? Give feedback.
-
In order to use this method, I'm assuming that all elements of the field array need to be mounted correct? |
Beta Was this translation helpful? Give feedback.
-
thanks man, I'm having the exact same issue :)) |
Beta Was this translation helpful? Give feedback.
-
This feature is released. 7.11.0 you can refer to the release note and change log. |
Beta Was this translation helpful? Give feedback.
-
I would be much appreciated if you could show me how to use this {update} code sample🙏🙏🙏 |
Beta Was this translation helpful? Give feedback.
-
What if there are async updates (and the indexes could change during the async cycle) ? |
Beta Was this translation helpful? Give feedback.
-
How can i use field array id for setting different rendering condition for rendering the element different way? |
Beta Was this translation helpful? Give feedback.
-
Context
The current API to update the field array is using
setValue
, which can b performed by the following API.The setValue method then needs to look up the fields reference to identify its field array inputs or normal inputs.
Problem
However, the current
setValue
API doesn't actually re-render theuseFieldArray
which causes confusion when developers assume it will behave similarly to the rest of useFieldArray's API, such asappend
,prepend
and etc.Feature request
#5728
Proposal
Ideally, we should have an update function to update the field array and trigger a re-render to the
userFieldArray
.the action itself will trigger a re-render to the entire field array and update all its references.
PR
#5835
Beta Was this translation helpful? Give feedback.
All reactions