Skip to content

Bug: <Activity /> does not behave as described in the official documentation. #35771

@M-Moong

Description

@M-Moong

React version:
v19.2.0

Steps To Reproduce

  1. Render <Activity>Hello, World!</Activity>
  <Activity>
    Hello, World!
  </Activity>
  1. Render <Activity><ComponentThatJustReturnsText /></Activity>
const ComponentThatJustReturnsText = () => "Hello, World!";

<Activity>
  <ComponentThatJustReturnsText />
</Activity>
  1. Regardless of whether the mode prop is provided or not, both plain text and components that return only text are rendered in the DOM.

Link to code example:
Reproducible with a minimal example using only React (no additional dependencies).

The current behavior

Text-only children inside <Activity /> are rendered correctly in the DOM.

  • Passing a plain string ("Hello, World!") directly works as expected.
  • Passing a component that returns only a string also renders without issues.
  • The mode prop still behaves correctly, and visibility changes are applied as expected.

The expected behavior

According to the official documentation:

An Activity that just renders text will not render anything rather than rendering hidden text,
because there’s no corresponding DOM element to apply visibility changes to.
For example, will not produce any output in the DOM for const ComponentThatJustReturnsText = () => "Hello, World!";.

Based on this description, text-only children should not produce any DOM output. However, in practice, they are rendered normally.

Related link

React documentation:
https://react.dev/reference/react/Activity#caveats

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions