Repository navigation
[DOM] Stop hiding siblings after a dehydrated Activity - #37814
Merged
Merged
Conversation
|
Comparing: b618bbb...2191fb6 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) Generated by sizebot against 2191fb6 |
Collaborator
|
Can you split the commit into one commit with just a characterizing test and a second commit with the fix + changed assertions. The test must pass in both commits. |
skrabe
force-pushed
the
fix-hide-dehydrated-activity
branch
from
October 12, 2026 08:50
2c1097c to
e7fe5a7
Compare
eps1lon
reviewed
Oct 12, 2026
skrabe
force-pushed
the
fix-hide-dehydrated-activity
branch
from
October 12, 2026 09:23
e7fe5a7 to
e40e459
Compare
eps1lon
reviewed
Oct 12, 2026
…r siblings When a dehydrated boundary is hidden, `hideOrUnhideDehydratedBoundary` walks the DOM nodes from the boundary's start marker and sets `display: none` on each element until it reaches the matching end marker. The walk only recognizes Suspense markers: it stops at `<!--/$-->` and counts only Suspense start markers for depth. For an Activity instance it never sees the boundary's `<!--/&-->`, so it continues to the end of the parent and hides every following sibling, nodes that are not part of the hidden tree. Showing the Activity again does not undo this. Its dehydrated content is client rendered, and nothing unhides the siblings, so they stay hidden. Next.js keeps a route it navigates away from in a hidden Activity. Leaving a page before its boundaries hydrated hides what the root layout renders after the page, such as toasts and the route announcer. The test pins down the current behavior. The fix in the next commit flips the sibling assertions: it stays visible while the Activity is hidden and after it is shown again.
`hideOrUnhideDehydratedBoundary` accepts an Activity instance but only recognized Suspense markers, so hiding a dehydrated Activity walked past its end marker and hid every following sibling in the parent. The walk now treats `<!--/&-->` as an end marker and counts `<!--&-->` for depth, as `clearHydrationBoundary` already does. Both are needed: with only the end marker, a nested Activity's `<!--/&-->` ends the walk early and leaves the rest of the boundary visible. The test from the previous commit flips its sibling assertions: the sibling stays visible while the Activity is hidden and after it is shown again. The test is renamed to match.
skrabe
force-pushed
the
fix-hide-dehydrated-activity
branch
from
October 12, 2026 10:51
e40e459 to
2191fb6
Compare
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 12, 2026
Fixes #37813. ## Summary `hideOrUnhideDehydratedBoundary` accepts an Activity instance but only recognizes Suspense markers. Hiding a dehydrated Activity walked past its `<!--/&-->` and set `display: none` on every following sibling in the parent, outside the hidden tree. Those siblings stayed hidden after the Activity was shown again. The walk now ends at `<!--/&-->` and counts `<!--&-->` for depth, matching `clearHydrationBoundary`. ## How did you test this change? The first commit adds a test to `ReactDOMServerPartialHydrationActivity-test` that pins down the current behavior: an Activity containing a dehydrated Activity (with a nested Activity inside it) is hidden, and the sibling after it ends up hidden too, and stays hidden after the Activity is shown again. It passes on `main`. The second commit is the fix, and flips the sibling assertions. With only the end-marker half of the fix, the test fails on the content after the nested Activity, so the depth counting is covered too. Ran: - `yarn test` and `yarn test --prod` for `ReactDOMServerPartialHydration*`, `ReactDOMActivity*` and `ReactDOMFizzSuspenseList`: all pass, at both commits for the new test. - `yarn test -r=stable` (dev and prod) for the new test, and `-r=stable` for `ReactDOMServerPartialHydration*`: all pass. - `yarn flow dom-node`, `yarn flow dom-browser`, `yarn linc`, `yarn prettier`: clean. DiffTrain build for [9f2e1f8](9f2e1f8)
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 12, 2026
Fixes #37813. ## Summary `hideOrUnhideDehydratedBoundary` accepts an Activity instance but only recognizes Suspense markers. Hiding a dehydrated Activity walked past its `<!--/&-->` and set `display: none` on every following sibling in the parent, outside the hidden tree. Those siblings stayed hidden after the Activity was shown again. The walk now ends at `<!--/&-->` and counts `<!--&-->` for depth, matching `clearHydrationBoundary`. ## How did you test this change? The first commit adds a test to `ReactDOMServerPartialHydrationActivity-test` that pins down the current behavior: an Activity containing a dehydrated Activity (with a nested Activity inside it) is hidden, and the sibling after it ends up hidden too, and stays hidden after the Activity is shown again. It passes on `main`. The second commit is the fix, and flips the sibling assertions. With only the end-marker half of the fix, the test fails on the content after the nested Activity, so the depth counting is covered too. Ran: - `yarn test` and `yarn test --prod` for `ReactDOMServerPartialHydration*`, `ReactDOMActivity*` and `ReactDOMFizzSuspenseList`: all pass, at both commits for the new test. - `yarn test -r=stable` (dev and prod) for the new test, and `-r=stable` for `ReactDOMServerPartialHydration*`: all pass. - `yarn flow dom-node`, `yarn flow dom-browser`, `yarn linc`, `yarn prettier`: clean. DiffTrain build for [9f2e1f8](9f2e1f8)
This was referenced Oct 12, 2026
eps1lon
added a commit
to vercel/next.js
that referenced
this pull request
Oct 14, 2026
[diff react/react@b618bbb4...07dde64d](react/react@b618bbb...07dde64) <details> <summary>React upstream changes</summary> - react/react#37710 - react/react#37814 - react/react#37778 - react/react#37688 - react/react#37796 </details> --------- Co-authored-by: next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com> Co-authored-by: Sebastian Sebbie Silbermann <[email protected]>
stefanprobst
added a commit
to acdh-oeaw/template-app-next
that referenced
this pull request
Nov 21, 2026
With `cacheComponents`, Next.js wraps each page in an `<Activity>`. When a client navigation hides a page that has not hydrated yet, React hides its server-rendered nodes by walking their siblings until the end of the boundary, but only recognizes Suspense markers, not Activity markers. It then also hides the layout content after the page, like the footer, and never shows it again. This failed the shell end-to-end tests in WebKit intermittently. The fix (react/react#37814) is in the React that `16.5.0-canary.59` bundles, but not in `16.4.6`, so our Next.js patch applies it to the bundled React builds until then.
This was referenced Nov 22, 2026
SiddharthMuramkar
added a commit
to SiddharthMuramkar/friends-of-animals
that referenced
this pull request
Nov 22, 2026
Main's #239 fences the @EXIT slot the same way this branch did, for the same React bug (react/react#37814); the layout now takes main's version and comment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #37813.
Summary
hideOrUnhideDehydratedBoundaryaccepts an Activity instance but only recognizes Suspense markers. Hiding a dehydrated Activity walked past its<!--/&-->and setdisplay: noneon every following sibling in the parent, outside the hidden tree. Those siblings stayed hidden after the Activity was shown again.The walk now ends at
<!--/&-->and counts<!--&-->for depth, matchingclearHydrationBoundary.How did you test this change?
The first commit adds a test to
ReactDOMServerPartialHydrationActivity-testthat pins down the current behavior: an Activity containing a dehydrated Activity (with a nested Activity inside it) is hidden, and the sibling after it ends up hidden too, and stays hidden after the Activity is shown again. It passes onmain.The second commit is the fix, and flips the sibling assertions. With only the end-marker half of the fix, the test fails on the content after the nested Activity, so the depth counting is covered too.
Ran:
yarn testandyarn test --prodforReactDOMServerPartialHydration*,ReactDOMActivity*andReactDOMFizzSuspenseList: all pass, at both commits for the new test.yarn test -r=stable(dev and prod) for the new test, and-r=stableforReactDOMServerPartialHydration*: all pass.yarn flow dom-node,yarn flow dom-browser,yarn linc,yarn prettier: clean.