You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Timeline shows the following nested update warning when a synchronous update causes an event handler to run long:
A big nested update was scheduled during layout. Nested updates require React to re-render synchronously before the browser can paint. Consider delaying this update by moving it to a passive effect (useEffect).
This warning was intended to encourage developers to move heavy updates from layout effects into passive effects so that they did not block paint or stretch event handlers.
Unfortunately this warning currently does not handle a few cases well:
Passive effects might be flushed synchronously (along with their updates) if a layout effect schedules a synchronous update.
This means that the current warning may be confusing or misleading. We should either update it to ensure that it never fires for updates that were already scheduled inside of a passive effect, or if that is not possible we should remove it entirely.
The text was updated successfully, but these errors were encountered:
As a side note, given that React heuristics like this may change between releases (as happened with "click" event behavior) we may need to rethink the source of Timeline warnings. Maybe these warnings belong inside of React itself (DEV and profiling builds) and should be communicated to DevTools using some standardized format?
Both layout and passive effects are processed synchronously, but while layout effect updates are flushed synchronously– passive effect updates are scheduled with "default" priority and flush after paint.
So the 1st scenario described in the issue above is possible, but the 2nd scenario was a misunderstanding between Dan and I.
Not sure exactly what's going on here, but we shouldn't be warning about this case since the update isn't actually being processed synchronously. (It's not blocking paint.)
Timeline shows the following nested update warning when a synchronous update causes an event handler to run long:
This warning was intended to encourage developers to move heavy updates from layout effects into passive effects so that they did not block paint or stretch event handlers.
Unfortunately this warning currently does not handle a few cases well:
Click events now always flush passive effects synchronously(see Bug: useEffect Timing changes depending on if Portal was rendered #20074 (comment)).This means that the current warning may be confusing or misleading. We should either update it to ensure that it never fires for updates that were already scheduled inside of a passive effect, or if that is not possible we should remove it entirely.
The text was updated successfully, but these errors were encountered: