facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
228.33k stars 46.71k forks source link

Bug: Webpack process and setImmediate polyfill interferes with time slicing #21685

Open gaearon opened 3 years ago

gaearon commented 3 years ago

Here's the copy paste of the polyfill: https://gist.github.com/gaearon/5d2f7bedf76d7bbec2b5c1ee04861ce3

This reproes with old CRA (e.g. react-scripts@0.7.0). I saw this on this branch: https://github.com/Swizec/react-fractals/pull/16

The result is concurrent renders get grouped into a huge blocking task:

Screenshot 2021-06-15 at 18 01 27

Not sure why yet.

gaearon commented 2 years ago

In CRA 4 there's also a setImmediate polyfill but at least it uses MessageChannel so it's not as bad.