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

RFC: pausing validation before unmount #595

Merged
merged 2 commits into from
Aug 18, 2019
Merged

Conversation

asazernik
Copy link
Contributor

I know that with classes this should go in componentWillUnmount(), but I'm not 100% clear on the semantics of useEffect(). Does it also run parent-first when a tree is being unmounted?

If this does what I expect it to, will fix #408. Will make a test case before removing the RFC tag.

This was causing serious performance problems on large forms, since
validation is generally O(number_fields), and we'd be calling it
number_fields times when running all the deregistrations.
@erikras
Copy link
Member

erikras commented Aug 18, 2019

Fantastic! 👍

@erikras erikras merged commit 093e5f6 into final-form:master Aug 18, 2019
@asazernik
Copy link
Contributor Author

Heh, alright. I hope you know what the useEffect semantics are better than I do 😅

@shrugs
Copy link

shrugs commented Aug 19, 2019

I can confirm that effect disposers are run parent-first, at least experientially.

@lock
Copy link

lock bot commented Sep 18, 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 Sep 18, 2019
@erikras
Copy link
Member

erikras commented Nov 18, 2019

Published in v6.3.1.

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.

Validations run on unmount creating unnecessary requests
3 participants