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

Fixed destroyOnUnregister bug #537

Merged
merged 2 commits into from
Jun 19, 2019
Merged

Fixed destroyOnUnregister bug #537

merged 2 commits into from
Jun 19, 2019

Conversation

erikras
Copy link
Member

@erikras erikras commented Jun 17, 2019

Fixes #523, but only for initial fields.

Because our fields have to register twice on first render, the destroyOnUnregister will naturally destroy the value on first render. This PR fixes the bug for fields that are present on first form render, but will not fix it for new ones added.

Update: Works now for all fields, regardless of when they are added.

@codecov
Copy link

codecov bot commented Jun 17, 2019

Codecov Report

Merging #537 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #537   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          16     16           
  Lines         225    228    +3     
  Branches       55     55           
=====================================
+ Hits          225    228    +3
Impacted Files Coverage Δ
src/useField.js 100% <100%> (ø) ⬆️
src/ReactFinalForm.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 817c731...a72e14e. Read the comment docs.

@zmitry
Copy link

zmitry commented Jun 17, 2019

But if I have dynamic fields this bug still we appear, right?

@erikras
Copy link
Member Author

erikras commented Jun 18, 2019

I might have an idea to avoid that. Stay tuned...

@erikras erikras merged commit a0f67cb into master Jun 19, 2019
@erikras erikras deleted the destroyOnUnregister-bug branch June 19, 2019 09:40
@erikras
Copy link
Member Author

erikras commented Jun 19, 2019

Published in v6.3.0.

@lock
Copy link

lock bot commented Jul 19, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

destroy on unregister breaks initial values
2 participants