Skip to content
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

Temporarily disable suspending during work loop #30762

Merged

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Aug 20, 2024

Based on


use has an optimization where in some cases it can suspend the work loop during the render phase until the data has resolved, rather than unwind the stack and lose context. However, the current implementation is not compatible with sibling prerendering. So I've temporarily disabled it until the sibling prerendering has been refactored. We will add it back in a later step.

Copy link

vercel bot commented Aug 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 23, 2024 4:00pm

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Aug 20, 2024
@acdlite acdlite changed the title Temporarily disable sibling prerendering Temporarily disable sibling suspending during work loop Aug 20, 2024
@acdlite acdlite changed the title Temporarily disable sibling suspending during work loop Temporarily disable suspending during work loop Aug 20, 2024
@acdlite acdlite force-pushed the temporarily-disable-sibling-prerendering branch from 81171c0 to 0e6571f Compare August 20, 2024 20:37
@acdlite acdlite force-pushed the temporarily-disable-sibling-prerendering branch 2 times, most recently from 24e1c11 to 0e6571f Compare August 20, 2024 20:40
@react-sizebot
Copy link

react-sizebot commented Aug 20, 2024

Comparing: b57d282...9759283

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.21% 500.37 kB 501.40 kB +0.21% 89.80 kB 89.99 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.14% 507.50 kB 508.22 kB +0.16% 90.96 kB 91.11 kB
facebook-www/ReactDOM-prod.classic.js +0.17% 595.24 kB 596.27 kB +0.16% 105.55 kB 105.72 kB
facebook-www/ReactDOM-prod.modern.js +0.18% 571.54 kB 572.56 kB +0.16% 101.75 kB 101.91 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-www/ReactART-prod.modern.js +0.40% 345.26 kB 346.63 kB +0.36% 58.83 kB 59.05 kB
facebook-www/ReactART-prod.classic.js +0.38% 362.26 kB 363.63 kB +0.34% 61.60 kB 61.81 kB
react-native/implementations/ReactFabric-prod.fb.js +0.37% 371.64 kB 373.01 kB +0.37% 65.02 kB 65.26 kB
react-native/implementations/ReactNativeRenderer-prod.fb.js +0.36% 376.86 kB 378.23 kB +0.36% 66.15 kB 66.39 kB
react-native/implementations/ReactFabric-profiling.fb.js +0.36% 399.18 kB 400.61 kB +0.34% 69.31 kB 69.55 kB
oss-stable-rc/react-art/cjs/react-art.production.js +0.35% 291.05 kB 292.08 kB +0.30% 50.22 kB 50.38 kB
oss-stable-semver/react-art/cjs/react-art.production.js +0.35% 291.05 kB 292.08 kB +0.30% 50.22 kB 50.38 kB
oss-stable/react-art/cjs/react-art.production.js +0.35% 291.11 kB 292.14 kB +0.30% 50.24 kB 50.40 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +0.35% 404.37 kB 405.80 kB +0.30% 70.41 kB 70.62 kB
oss-stable-rc/react-test-renderer/cjs/react-test-renderer.production.js +0.34% 300.23 kB 301.26 kB +0.34% 53.34 kB 53.52 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.production.js +0.34% 300.23 kB 301.26 kB +0.34% 53.34 kB 53.52 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.production.js +0.34% 300.29 kB 301.32 kB +0.34% 53.36 kB 53.54 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-prod.js +0.32% 317.72 kB 318.75 kB +0.30% 56.26 kB 56.43 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-profiling.js +0.30% 341.68 kB 342.71 kB +0.28% 59.73 kB 59.90 kB
react-native/implementations/ReactFabric-prod.js +0.30% 345.57 kB 346.60 kB +0.26% 60.76 kB 60.92 kB
react-native/implementations/ReactNativeRenderer-prod.js +0.29% 354.91 kB 355.94 kB +0.25% 62.36 kB 62.52 kB
react-native/implementations/ReactFabric-profiling.js +0.27% 372.95 kB 373.97 kB +0.25% 64.87 kB 65.03 kB
react-native/implementations/ReactNativeRenderer-profiling.js +0.27% 382.22 kB 383.25 kB +0.24% 66.60 kB 66.76 kB
oss-stable-rc/react-reconciler/cjs/react-reconciler.production.js +0.25% 376.50 kB 377.45 kB +0.25% 61.98 kB 62.13 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.production.js +0.25% 376.50 kB 377.45 kB +0.25% 61.98 kB 62.13 kB
oss-stable/react-reconciler/cjs/react-reconciler.production.js +0.25% 376.53 kB 377.47 kB +0.25% 62.00 kB 62.15 kB
facebook-www/ReactReconciler-prod.modern.js +0.24% 437.01 kB 438.08 kB +0.26% 71.25 kB 71.43 kB
oss-stable-rc/react-reconciler/cjs/react-reconciler.profiling.js +0.24% 404.88 kB 405.85 kB +0.26% 66.01 kB 66.18 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.profiling.js +0.24% 404.88 kB 405.85 kB +0.26% 66.01 kB 66.18 kB
oss-stable/react-reconciler/cjs/react-reconciler.profiling.js +0.24% 404.91 kB 405.87 kB +0.23% 66.05 kB 66.20 kB
facebook-www/ReactReconciler-prod.classic.js +0.24% 455.76 kB 456.84 kB +0.24% 74.03 kB 74.21 kB
oss-stable-rc/react-dom/cjs/react-dom-client.production.js +0.21% 500.27 kB 501.29 kB +0.21% 89.78 kB 89.96 kB
oss-stable-semver/react-dom/cjs/react-dom-client.production.js +0.21% 500.27 kB 501.29 kB +0.21% 89.78 kB 89.96 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.21% 500.37 kB 501.40 kB +0.21% 89.80 kB 89.99 kB

Generated by 🚫 dangerJS against f72bdce

@@ -558,6 +558,7 @@ describe('ReactUse', () => {
}
});

// @gate !enableSiblingPrerendering
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help if I wrote the tests for when this is on?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some more later in the stack, but perhaps I'll move a few into this PR

// TODO: Suspending the work loop during the render phase is currently
// not compatible with sibling prerendering. We will add this optimization
// back in a later step.
enableSuspendingDuringWorkLoop: !featureFlags.enableSiblingPrerendering,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to gate the other tests with this flag, or are you going to use it later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah I changed them in a later step, will update

This is a refactor of the fix in facebook#27505.

When a transition update is scheduled by a popstate event, (i.e. a back/
forward navigation) we attempt to render it synchronously even though
it's a transition, since it's likely the previous page's data is cached.

In facebook#27505, I changed the implementation so that it only "upgrades" the
priority of the transition for a single attempt. If the attempt
suspends, say because the data is not cached after all, from then on it
should be treated as a normal transition.

But it turns out facebook#27505 did not work as intended, because it relied on
marking the root with pending synchronous work (root.pendingLanes),
which was never cleared until the popstate update completed.

The test scenarios I wrote accidentally worked for a different reason
related to suspending the work loop, which I'm currently in the middle
of refactoring.
`use` has an optimization where in some cases it can suspend the work
loop during the render phase until the data has resolved, rather than
unwind the stack and lose context. However, the current implementation
is not compatible with sibling prerendering. So I've temporarily
disabled it until the sibling prerendering has been refactored. We will
add it back in a later step.
@acdlite acdlite force-pushed the temporarily-disable-sibling-prerendering branch from 02a280b to f72bdce Compare August 23, 2024 15:58
@acdlite acdlite merged commit 8b4c54c into facebook:main Sep 4, 2024
184 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 4, 2024
### Based on

- #30761
- #30759

---

`use` has an optimization where in some cases it can suspend the work
loop during the render phase until the data has resolved, rather than
unwind the stack and lose context. However, the current implementation
is not compatible with sibling prerendering. So I've temporarily
disabled it until the sibling prerendering has been refactored. We will
add it back in a later step.

DiffTrain build for [8b4c54c](8b4c54c)
github-actions bot pushed a commit that referenced this pull request Sep 4, 2024
### Based on

- #30761
- #30759

---

`use` has an optimization where in some cases it can suspend the work
loop during the render phase until the data has resolved, rather than
unwind the stack and lose context. However, the current implementation
is not compatible with sibling prerendering. So I've temporarily
disabled it until the sibling prerendering has been refactored. We will
add it back in a later step.

DiffTrain build for commit 8b4c54c.
gnoff pushed a commit to vercel/next.js that referenced this pull request Sep 12, 2024
**breaking change for canary users: Bumps peer dependency of React from
`19.0.0-rc-7771d3a7-20240827` to `19.0.0-rc-94e652d5-20240912`**

[diff
facebook/react@7771d3a7...94e652d5](facebook/react@7771d3a...94e652d)

<details>
<summary>React upstream changes</summary>

- facebook/react#30952
- facebook/react#30950
- facebook/react#30946
- facebook/react#30934
- facebook/react#30947
- facebook/react#30945
- facebook/react#30938
- facebook/react#30936
- facebook/react#30879
- facebook/react#30888
- facebook/react#30931
- facebook/react#30930
- facebook/react#30832
- facebook/react#30929
- facebook/react#30926
- facebook/react#30925
- facebook/react#30905
- facebook/react#30900
- facebook/react#30910
- facebook/react#30906
- facebook/react#30899
- facebook/react#30919
- facebook/react#30708
- facebook/react#30907
- facebook/react#30897
- facebook/react#30896
- facebook/react#30895
- facebook/react#30887
- facebook/react#30889
- facebook/react#30893
- facebook/react#30892
- facebook/react#30891
- facebook/react#30882
- facebook/react#30881
- facebook/react#30870
- facebook/react#30849
- facebook/react#30878
- facebook/react#30865
- facebook/react#30869
- facebook/react#30875
- facebook/react#30800
- facebook/react#30762
- facebook/react#30831
- facebook/react#30866
- facebook/react#30853
- facebook/react#30850
- facebook/react#30847
- facebook/react#30842
- facebook/react#30837
- facebook/react#30848
- facebook/react#30844
- facebook/react#30839
- facebook/react#30802
- facebook/react#30841
- facebook/react#30827
- facebook/react#30826
- facebook/react#30825
- facebook/react#30824
- facebook/react#30840
- facebook/react#30838
- facebook/react#30836
- facebook/react#30819
- facebook/react#30816
- facebook/react#30814
- facebook/react#30813
- facebook/react#30812
- facebook/react#30811

</details>

---------

Co-authored-by: vercel-release-bot <infra+release@vercel.com>
mofeiZ added a commit that referenced this pull request Oct 11, 2024
### Based on

- #30761
- #30759

---

`use` has an optimization where in some cases it can suspend the work
loop during the render phase until the data has resolved, rather than
unwind the stack and lose context. However, the current implementation
is not compatible with sibling prerendering. So I've temporarily
disabled it until the sibling prerendering has been refactored. We will
add it back in a later step.

[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants