-
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
[Umbrella] Async rendering #8830
Comments
Exciting list! When I read https://developers.google.com/web/updates/2015/08/using-requestidlecallback a paragraph caught especially my attention regarding how to use
And I was hoping to see if that idea was planned to be potentially included in React if you had the same findings in your measurements. Seeing the third bullet in the bigger items list just answered my question 😄 |
@amjoshi91 Friendly heads up: that item is outdated and isn't quite right. Generally, the items in this issue fairly complex (even the smaller ones) and will be hard for an outside contributor to complete. It will be easier to contribute once more of the core pieces are in place. We'll do our best to identify those opportunities as they come up. :) EDIT: Comment I responded to was deleted ¯\_(ツ)_/¯ |
Does async work poorly if you don't have shouldComponentUpdate everywhere because the reuse mechanism isn't as good? Maybe the other mechanisms cover it. |
@sebmarkbage I was thinking that, too. It's interesting because the accepted best practice today is to not use |
Hey, I have a maybe dumb question about the polyfill for Looking at the source for ReactDOMFrameScheduling, I see that you are using a polyfill that is limited to the scope of My worry is: if I use a polyfill for } else if (typeof requestIdleCallback !== 'function') { In short: is there anything I should think about when using a polyfill for |
@JobLeonard Good observation. Yes. Most @acdlite Do we have an item on here to ensure that |
More recent issue #11566 |
Async rendering is incomplete. There are bugs with the existing implementation and crucial features that are missing.
Specifically, the bugs are related to resuming work after it has been interupted.
#9695 was an effort to clean up the bugs without fundamentally changing the underlying model. In the course of working on that branch, we've decided that the underlying model is inherently flawed and needs to change. The tricky case is when low priority work is interrupted by a higher priority update. We want to be able to reconcile again at the higher priority without losing the low priority children, so that we can resume them later. There's no way to do this with the existing model.
So we're going to scrap the model and start again.
Scrap existing "progressed work" implementation and its bugs
This will give us a better foundation upon which to build the new model. It should also fix bugs in the triangle demo, although starvation will clearly be worse. We should aim for correctness before comprehensiveness.
SplitpendingWorkPriority
from the update priority so that it represents the priority of the subtree, but not the fiber it belongs to. This lets us know whether the children have remaining work.Expiration times
The next step will be to implement expiration times so that low priority work doesn't. It's possible that expiration times alone are sufficient to generate real product wins, even without the ability to resume interrupted work.
Async top-level API
Keep track of next unit of work per root
scheduleUpdate
(setState
) currently does not always reach the root, so when we receive an update on a fiber, we don't necessarily know which tree the fiber belongs to.Flush interaction work synchronously
Expiration boundaries and blockers (shouldComponentBlock)
Still figuring out the details for how this will work
shouldComponentBlock(props, state)
renderExpired
tree instead.this.ping
(actual name TK).Resuming interrupted work
Then we can move onto to addressing the problem of resuming interrupted work.
progressedPriority
should represent the priority that the parent last reconciled at.child
is a set of all children, present and future (and maybe some in the past)?Other items
Don't commit duringrequestIdleCallback
. Wait until the next animation frame, then flush animation work using the last completed priority level. If the work overlaps, we may be able to reuse it. (This item may need to wait until we switch to expiration times.)rIC
orrAF
events.Solve stale event listeners: When a component receives an interaction event, flush updates in parents and "simulate" a render to recreate event handler before calling it.Solve the case where you want to show some fallback content only if the primary content takes too long but not if it is fast. Such as rendering a spinner if an async render takes too long. What if when the general expiration time elapsed for an async tree, we started calling an alternateThis is Suspense.renderExpired
tree instead? That way we can render the tree with a spinner, only if it took too long to render.The text was updated successfully, but these errors were encountered: