-
Notifications
You must be signed in to change notification settings - Fork 46.1k
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
[Fiber] Separate priority for updates #8538
Commits on Dec 15, 2016
-
Don't drop updates until they are committed
Restructures the update queue to maintain a pointer to the first pending update, which solves a few problems: - Updates that occur during the begin phase (e.g. in cWRP of a child) aren't dropped, like they are currently. This isn't working yet because the work priority is reset during completion. The following item will fix it. - Sets us up to be able to add separate priorities to each update in the queue. I'll add this in a subsequent commit.
Configuration menu - View commit details
-
Copy full SHA for cbba5ef - Browse repository at this point
Copy the full SHA cbba5efView commit details -
Schedule callback effects while merging updates
This allows us to remove the hasCallback flag.
Configuration menu - View commit details
-
Copy full SHA for 6301086 - Browse repository at this point
Copy the full SHA 6301086View commit details -
Replace .hasForceUpdate with ForceUpdate effect
Removes another field from the update queue
Configuration menu - View commit details
-
Copy full SHA for cb1ef03 - Browse repository at this point
Copy the full SHA cb1ef03View commit details -
When resetting the priority in the complete phase, check the priority of the update queue so that updates aren't dropped. Updates inside render, child cWRP, etc are no longer dropped. The next step is sort the queue by priority and only flush updates that match the current priority level.
Configuration menu - View commit details
-
Copy full SHA for 94011e9 - Browse repository at this point
Copy the full SHA 94011e9View commit details -
Use lastProgressedUpdate pointer instead of firstPendingUpdate
We need to be able to access both, and since the list uses forward pointers, it makes more sense to point to the one that comes first. Otherwise to get the last progressed update you have to start at the beginning of the list.
Configuration menu - View commit details
-
Copy full SHA for bb844a0 - Browse repository at this point
Copy the full SHA bb844a0View commit details -
Apply pending updates in order of priority
The queue maintains a pointer to the last progressed update in the list. Updates that come after that pointer are pending. The pointer is set to the end of the list during reconciliation. Pending updates are sorted by priority then insertion. Progressed updates are sorted by the order in which they were applied during reconciliation, which may not be by priority: if a component bails out before the updates are committed, in the next render, the progressed updates are applied in the same order that they were previously, even if a higher priority update comes in. Once a progressed update is flushed/committed, it's removed from the queue.
Configuration menu - View commit details
-
Copy full SHA for 20f0004 - Browse repository at this point
Copy the full SHA 20f0004View commit details -
This is needed to get the triangle demo working.
Configuration menu - View commit details
-
Copy full SHA for ead8ab7 - Browse repository at this point
Copy the full SHA ead8ab7View commit details -
Don't rely on commit phase effect to clear updates
Instead clear updates on the work-in-progress during the begin phase. Aborted updates are recovered by cloning from the current fiber.
Configuration menu - View commit details
-
Copy full SHA for d7f89b8 - Browse repository at this point
Copy the full SHA d7f89b8View commit details -
Add fast path for appending updates to the end of the queue
This is the most common case, so we should avoid scanning the entire list to get to the end.
Configuration menu - View commit details
-
Copy full SHA for babace0 - Browse repository at this point
Copy the full SHA babace0View commit details -
Handle setState inside an updater function
The update is scheduled as if the current processing update has already been processed; if it has the same or higher priority, it will be flushed in the same batch. We also print a warning.
Configuration menu - View commit details
-
Copy full SHA for e0981b8 - Browse repository at this point
Copy the full SHA e0981b8View commit details -
Priority context during reconciliation
setState inside render/cWRP should have the same priority as whatever level is currently being reconciled.
Configuration menu - View commit details
-
Copy full SHA for eec4312 - Browse repository at this point
Copy the full SHA eec4312View commit details -
Simplify test for whether we should flush a pending commit
We can just check if the deadline has expired.
Configuration menu - View commit details
-
Copy full SHA for df9603e - Browse repository at this point
Copy the full SHA df9603eView commit details -
Move priority context change to findNextUnitOfWork
...rather than changing it on every unit of work.
Configuration menu - View commit details
-
Copy full SHA for e1b733f - Browse repository at this point
Copy the full SHA e1b733fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 496512f - Browse repository at this point
Copy the full SHA 496512fView commit details -
3
Configuration menu - View commit details
-
Copy full SHA for 3a946fe - Browse repository at this point
Copy the full SHA 3a946feView commit details
Commits on Dec 16, 2016
-
Go back to using a flag, instead. I removed it before because I thought we might want to get rid of the top-level UpdateQueue type and put the fields directly on the fiber, but since we're keeping UpdateQueue we can put hasForceUpdate on there.
Configuration menu - View commit details
-
Copy full SHA for b8441ba - Browse repository at this point
Copy the full SHA b8441baView commit details