Skip to content
New issue

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

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

Already on GitHub? # to your account

Silent initial field registration to avoid React warning #766

Merged
merged 1 commit into from
Mar 30, 2020

Conversation

erikras
Copy link
Member

@erikras erikras commented Mar 30, 2020

As of React v16.13.0, there has been a warning. In v16.13.1, they pointed it directly to https://fb.me/setstate-in-render (facebook/react#18178 (comment)).

This PR fixes the problem by using a new feature in final-form@4.19.0 that allows "silent" field registration that does not notify everyone else. Interestingly, this should also be a performance improvement for adding new fields.

Fixes #751.

@codecov
Copy link

codecov bot commented Mar 30, 2020

Codecov Report

Merging #766 into master will not change coverage by %.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #766   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines          251       251           
  Branches        58        58           
=========================================
  Hits           251       251           
Impacted Files Coverage Δ
src/useField.js 100.00% <100.00%> (ø)

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 a617789...4dda676. Read the comment docs.

@erikras erikras merged commit b27d119 into master Mar 30, 2020
@erikras erikras deleted the silent-initial-field-registration branch March 30, 2020 19:51
@erikras
Copy link
Member Author

erikras commented Mar 30, 2020

Published in v6.4.0.

@lock
Copy link

lock bot commented May 5, 2020

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 May 5, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning: Cannot update a component from inside the function body of a different component.
1 participant