Skip to content

Bug: Hiding a dehydrated Activity hides every sibling after it #37813

Closed

Description

@skrabe

React version: 19.3.0 (also main)

Steps To Reproduce

  1. Server-render an <Activity> and hydrate it, but keep it dehydrated (here a child suspends on the client).
  2. Hide an <Activity> that contains it.
<div>
  <Activity mode={mode}>
    <Activity>
      <Content /> {/* suspends on the client */}
    </Activity>
  </Activity>
  <p id="sibling">sibling</p>
</div>

Link to code example: https://gist.github.com/skrabe/9f587119a1b7f5b70ff5929fabbc0f5f (npm install && node repro.mjs, jsdom only)

The current behavior

#sibling gets display: none, even though it is outside both Activities. It stays hidden after the Activity is shown again.

<div><!--&--><!--&--><span style="display: none;">content</span><!--/&--><!--/&--><p id="sibling" style="display: none;">sibling</p></div>

hideOrUnhideDehydratedBoundary walks siblings until <!--/$--> and only counts Suspense start markers for depth. On an Activity instance it never sees its end, so it hides every following sibling in the parent.

The expected behavior

Only the dehydrated Activity's content is hidden. The walk should stop at the matching <!--/&--> and count nested <!--&-->, like clearHydrationBoundary does.

In Next.js with Cache Components, this hides everything a layout renders after {children} (toasts, the route announcer) when you navigate before the previous page has hydrated. Same scenario as #37135.

Activity

  1. added a commit that references this issue on Oct 12, 2026
    9f2e1f8
  2. added 2 commits that reference this issue on Oct 12, 2026
    7ed848c
    1c39d16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions