dai-shi/use-context-selector

Why using runWithNormalPriority in createProvider?

djknight1 opened this issue · 2 comments

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

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.

@dai-shi
Thanks for responding