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
Looking at the "DevTool", it is found that the most recently added element is not tracked
Click "Submit" and find that the final submitted data does not have a corresponding element
Expected behaviour
It is hoped that if shouldUnregister is enabled globally, the array element data can be tracked normally
After testing, I found that the execution of "unregister" is later than "register", in strict mode, "register" is executed twice, "unregister" is executed once, and it is executed later, which leads to the deletion of the field, and after debugging, the problem may be in the screenshot of the code of "useController", and "unregister" will be executed later than "register" in the code of "useEffect". "unregister" will be executed later than "register".
What browsers are you seeing the problem on?
No response
Relevant log output
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Version Number
7.49.2
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/react-hook-form-unregister-bug-pm4f5f?file=%2Fsrc%2FApp.tsx%3A17%2C22
Steps to reproduce
Expected behaviour
It is hoped that if shouldUnregister is enabled globally, the array element data can be tracked normally
![image](https://private-user-images.githubusercontent.com/23015246/292189624-4494c946-c043-429a-be9b-74d800afec03.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjE2MzgsIm5iZiI6MTczODk2MTMzOCwicGF0aCI6Ii8yMzAxNTI0Ni8yOTIxODk2MjQtNDQ5NGM5NDYtYzA0My00MjlhLWJlOWItNzRkODAwYWZlYzAzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIwNDg1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVlODNjMGE4N2U5NzViMmMxODQyNTRlMDZjYTU5YjUxNzNkNzNiMmFlYzdmZTRkYjM3ZWE3NTJhZTNkZTU5ZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BZslUUlTmokYbCh5xPGRpexPE3cOIWtAjHZhQy76_7E)
![image](https://private-user-images.githubusercontent.com/23015246/292191347-2b458303-bbad-49f5-8448-7caa9c1bc6e8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjE2MzgsIm5iZiI6MTczODk2MTMzOCwicGF0aCI6Ii8yMzAxNTI0Ni8yOTIxOTEzNDctMmI0NTgzMDMtYmJhZC00OWY1LTg0NDgtN2NhYTljMWJjNmU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIwNDg1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM5ODQ1NGVhYjJhYTI2MGYxNzBhZjgwYjU4Zjc3NjI1YTkxNDk4ZmVlMDcwMTFkZGFlMmM0NjFhNTI0YzFhZjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.tZbwOqWYY7RnXFLWC22AQY4b63q0GcPAd249drxrYCk)
After testing, I found that the execution of "unregister" is later than "register", in strict mode, "register" is executed twice, "unregister" is executed once, and it is executed later, which leads to the deletion of the field, and after debugging, the problem may be in the screenshot of the code of "useController", and "unregister" will be executed later than "register" in the code of "useEffect". "unregister" will be executed later than "register".
What browsers are you seeing the problem on?
No response
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: