Skip to content

Conversation

devsrv
Copy link
Contributor

@devsrv devsrv commented Jul 12, 2021

Screen Recording (13-07-2021 01-00-32 AM) (1)

ISSUE:
when resetting parts of form fields like: reset('password'), all other left fields data gets removed.

this is because the initialValue of the Array.reduce() is set to blank {} so the setData hook keeps only the fields data that were mentioned in reset() method called by user.

SOLVE:
if the initialValue is set to the current field values as a copy {...data} then it can be fixed ✌

@devsrv devsrv changed the title fix resetting partial form data removing all other fields fix resetting partial form data removing all other fields - REACT useForm Jul 13, 2021
@reinink reinink merged commit ed20f69 into inertiajs:master Jul 14, 2021
@reinink
Copy link
Member

reinink commented Jul 14, 2021

Nice catch! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants