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

Why using runWithNormalPriority in createProvider? #74

Closed
djknight1 opened this issue Apr 8, 2022 · 2 comments
Closed

Why using runWithNormalPriority in createProvider? #74

djknight1 opened this issue Apr 8, 2022 · 2 comments

Comments

@djknight1
Copy link

While reading source code, it's hard to understand why you using runWithNormalPriority in createProvider.
Would you mind explaining it?

@dai-shi
Copy link
Owner

dai-shi commented Apr 8, 2022

We want to use useLayoutEffect, because useEffect is not appropriate (too late to change state).
React seems to use high priority in useLayoutEffect, so we need to force changing to normal priority. otherwise, rendering can't be interrupted.

@djknight1
Copy link
Author

@dai-shi
Thanks for responding

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

No branches or pull requests

2 participants