-
Notifications
You must be signed in to change notification settings - Fork 47k
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
use: Don't suspend if there are pending updates #25632
Conversation
Comparing: 44c4e6f...9ae639e Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
// Finally, React attempts to render the first update again. It also | ||
// finishes successfully, because it was rebased on top of the update that | ||
// hid the suspended component. | ||
// NOTE: These this render happened to not be entangled with the previous | ||
// one. If they had been, this update would have been included in the | ||
// previous render, and there wouldn't be an extra one here. This could | ||
// change if we change our entanglement heurstics. Semantically, it | ||
// shouldn't matter, though in general we try to work on transitions in | ||
// parallel whenever possible. So even though in this particular case, the | ||
// extra render is unnecessary, it's a nice property that it wasn't | ||
// entangled with the other transition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filled in some this/that references from my understanding. I hope this makes it easier to grasp what's happening?
// Finally, React attempts to render the first update again. It also | |
// finishes successfully, because it was rebased on top of the update that | |
// hid the suspended component. | |
// NOTE: These this render happened to not be entangled with the previous | |
// one. If they had been, this update would have been included in the | |
// previous render, and there wouldn't be an extra one here. This could | |
// change if we change our entanglement heurstics. Semantically, it | |
// shouldn't matter, though in general we try to work on transitions in | |
// parallel whenever possible. So even though in this particular case, the | |
// extra render is unnecessary, it's a nice property that it wasn't | |
// entangled with the other transition. | |
// Finally, React attempts to render the first update again. It also | |
// finishes successfully, because it was rebased on top of the update that | |
// hid the suspended component. | |
// NOTE: The second render happened to not be entangled with the previous | |
// one. If they had been, the second update would have been included in the | |
// previous render, and there wouldn't be an extra render here. This could | |
// change if we change our entanglement heurstics. Semantically, it | |
// shouldn't matter, though in general we try to work on transitions in | |
// parallel whenever possible. So even though in this particular case, the | |
// extra render is unnecessary, it's a nice property that it wasn't | |
// entangled with the other transition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats amazing
Before suspending, check if there are other pending updates that might possibly unblock the suspended component. If so, interrupt the current render and switch to working on that. This logic was already implemented for the old "throw a Promise" Suspense but has to be replicated for `use` because it suspends the work loop much earlier. I'm getting a little anxious about the divergence between the two Suspense patterns. I'm going to look into enabling the new behavior for the old pattern so that we can unify the implementations.
cb328ab
to
9ae639e
Compare
Closed as part of stack in #25695 |
Before suspending, check if there are other pending updates that might possibly unblock the suspended component. If so, interrupt the current render and switch to working on that.
This logic was already implemented for the old "throw a Promise" Suspense but has to be replicated for
use
because it suspends the work loop much earlier.I'm getting a little anxious about the divergence between the two Suspense patterns. I'm going to look into enabling the new behavior for the old pattern so that we can unify the implementations.