Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix resetting partial form data removing all other fields - REACT useForm #802

Merged
merged 2 commits into from
Jul 14, 2021
Merged

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.

None yet

2 participants