master
Commits on Apr 24, 2021
-
Expiration: Do nothing except disable time slicing (#21345)
We have a feature called "expiration" whose purpose is to prevent a concurrent update from being starved by higher priority events. If a lane is CPU-bound for too long, we finish the rest of the work synchronously without allowing further interruptions. In the current implementation, we do this in sort of a roundabout way: once a lane is determined to have expired, we entangle it with SyncLane and switch to the synchronous work loop. There are a few flaws with the approach. One is that SyncLane has a particular semantic meaning besides its non-yieldiness. For example, `flushSync` will force remaining Sync work to finish; currently, that also includes expired work, which isn't an intended behavior, but rather an artifact of the implementation. An event worse example is that passive effects triggered by a Sync update are flushed synchronously, before paint, so that its result is guaranteed to be observed by the next discrete event. But expired work has no such requirement: we're flushing expired effects before paint unnecessarily. Aside from the behaviorial implications, the current implementation has proven to be fragile: more than once, we've accidentally regressed performance due to a subtle change in how expiration is handled. This PR aims to radically simplify how we model starvation protection by scaling back the implementation as much as possible. In this new model, if a lane is expired, we disable time slicing. That's it. We don't entangle it with SyncLane. The only thing we do is skip the call to `shouldYield` in between each time slice. This is identical to how we model synchronous-by-default updates in React 18.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 23, 2021
-
Delete unreferenced type (#21343)
Had already deleted all the uses but didn't remove the type itself.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Restore context after an error happens (#21341)
Typically we don't need to restore the context here because we assume that we'll terminate the rest of the subtree so we don't need the correct context since we're not rendering any siblings. However, after a nested suspense boundary we need to restore the context. The boundary could do this but since we're already doing this in the suspense branch of renderNode, we might as well do it in the error case which isn't very perf sensitive anyway.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 22, 2021
-
[Fizz] Add FB specific streaming API and build (#21337)
Add FB specific streaming API and build
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
[Fizz] Wire up the Fixture (#21273)
* Wire up fizz to fixture * Fixed typo conditional
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Don't flush sync at end of discreteUpdates (#21327)
All it should do is change the priority. The updates will be flushed by the microtask.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 21, 2021
-
Fix: Don't flush discrete at end of batchedUpdates (#21229)
The outermost `batchedUpdates` call flushes pending sync updates at the end. This was intended for legacy sync mode, but it also happens to flush discrete updates in concurrent mode. Instead, we should only flush sync updates at the end of `batchedUpdates` for legacy roots. Discrete sync updates can wait to flush in the microtask. `discreteUpdates` has the same issue, which is how I originally noticed this, but I'll change that one in a separate commit since it requires updating a few (no longer relevant) internal tests.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Continuous updates should interrupt transitions (#21323)
Even when updates are sync by default. Discovered this quirk while working on #21322. Previously, when sync default updates are enabled, continuous updates are treated like default updates. We implemented this by assigning DefaultLane to continous updates. However, an unintended consequence of that approach is that continuous updates would no longer interrupt transitions, because default updates are not supposed to interrupt transitions. To fix this, I changed the implementation to always assign separate lanes for default and continuous updates. Then I entangle the lanes together.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Use performConcurrentWorkOnRoot for "sync default" (#21322)
Instead of `performSyncWorkOnRoot`. The conceptual model is that the only difference between sync default updates (in React 18) and concurrent default updates (in a future major release) is time slicing. All other behavior should be the same (i.e. the stuff in `finishConcurrentRender`). Given this, I think it makes more sense to model the implementation this way, too. This exposed a quirk in the previous implementation where non-sync work was sometimes mistaken for sync work and flushed too early. In the new implementation, `performSyncWorkOnRoot` is only used for truly synchronous renders (i.e. `SyncLane`), which should make these mistakes less common. Fixes most of the tests marked with TODOs from #21072.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 20, 2021
-
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Fix sloppy factoring in `performSyncWorkOnRoot` (#21246)
* Warn if `finishedLanes` is empty in commit phase See #21233 for context. * Fix sloppy factoring when assigning finishedLanes `finishedLanes` is assigned in `performSyncWorkOnRoot` and `performSyncWorkOnRoot`. It's meant to represent whichever lanes we used to render, but because of some sloppy factoring, it can sometimes equal `NoLanes`. The fixes are: - Always check if the lanes are not `NoLanes` before entering the work loop. There was a branch where this wasn't always true. - In `performSyncWorkOnRoot`, don't assume the next lanes are sync; the priority may have changed, or they may have been flushed by a previous task. - Don't re-assign the `lanes` variable (the one that gets assigned to `finishedLanes` until right before we enter the work loop, so that it is always corresponds to the newest complete root.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Remove `flushDiscreteUpdates` from end of event (#21223)
We don't need this anymore because we flush in a microtask. This should allow us to remove the logic in the event system that tracks nested event dispatches. I added a test to confirm that nested event dispatches don't triggger a synchronous flush, like they would if we wrapped them `flushSync`. It already passed; I added it to prevent a regression.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
-
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 19, 2021
-
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
-
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 16, 2021
-
Revert expiration for retry lanes (#21300)
Retries should be allowed to expire if they are CPU bound for too long, but when I made this change it caused a spike in browser crashes. There must be some other underlying bug; not super urgent but ideally should figure out why and fix it. Unfortunately we don't have a repro for the crashes, only detected via production metrics.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
-
DevTools fork console patching logic (#21301)
React has its own component stack generation code that DevTools embeds a fork of, but both of them use a shared helper for disabling console logs. This shared helper is DEV only though, because it was intended for use with React DEV-only warnings and we didn't want to unnecessarily add bytes to production builds. But DevTools itself always ships as a production build– even when it's used to debug DEV bundles of product apps (with third party DEV-only warnings). That means this helper was always a noop. The resolveCurrentDispatcher method was changed recently to replace the thrown error with a call to console.error. This newly logged error ended up slipping through and being user visible because of the above issue. This PR updates DevTools to also fork the console patching logic (to remove the DEV-only guard). Note that I didn't spot this earlier because my test harness (react-devtools-shell) always runs in DEV mode.
🤡 Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 15, 2021
-
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Add dynamic flags to React Native (#21291)
* Add dynamic flags to React Native * Hardcode the setting to false instead
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
[Fizz] Two More Fixes (#21288)
* Emit value of option tags * Mask the legacy context passed to classes
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits
Commits on Apr 14, 2021
-
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits -
Emit reactroot attribute on the first element we discover (#21154)
This may not be the first root element if the root is a fragment and the second one unsuspends first. But this tag doesn't work well for root fragments anyway.
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.GPG key ID: 4AEE18F83AFDEB23 Learn about signing commits