useFieldArray's update() and replace() reset Dirtyfields in Edit
This is a wierd one.
When using update() or replace() method from useFieldArray. The Dirtyfields do get reset while in <Edit> View which seems wrong. Same scenario in <Create> View works, however.
Steps to reproduce:
Visit codesandbox i prepared: https://codesandbox.io/p/github/capsloq/form-react-hook-form-use-steps-form
1. Click
Create Post
2. Type something into Title Field
3. Go To Step 2 by clicking Next
4. Klick "klick this to use update()" button
5. Notice that title is still dirty after clicking the button ✅
6. If you go back to Step 1 you will see that the Title you typed is still there.
Now go back to all posts (/posts)
1. Click on the Edit
Button of one post
2. Type something into Title Field
3. Go To Step 2 by clicking Next
4. Klick "klick this to use update()" button
5. Notice that title is not dirty anymore after clicking the button and the value form Step 1 is lost ❌
Is that intentional or whats happening here?
I was not able to reproduce that with the original react-hook-form.
Thank youCodeSandbox
CodeSandbox is an online editor tailored for web applications.
5 Replies
xenial-black•2y ago
Hey @zomh, thanks for the detailed explanation🙏🏽 We'll definitely look into it and get back to you. 🚀
sensitive-blue•2y ago
any updates on this ? @yildirayunlu just a friendly reminder, no stress 🫶
xenial-black•2y ago
Hey @zomh Thank you for the kind reminder 🙏🏼 I will try to look at it during the day.
Hey @zomh I reproduce the issue today. Not sure if it's from the
refine
. Can you open an issue about it?sensitive-blue•2y ago
@yildirayunlu done
GitHub
[BUG] useFieldArray's update() and replace() reset dirtyfields in E...
Describe the bug When using update() or replace() method from useFieldArray. The dirtyfields do get reset while in <Edit> View which seems wrong. However, the same scenario but wrappe...