Skip to content

ui-react: the README shell keeps re-rendering the hidden chat on every streamed frame #2595

Open

Description

@schlessera

Context

The usage example in the ui-react README keeps ChatPage mounted under a display: none wrapper while Graph or Activity shows, so an in-flight turn keeps its transcript state (packages/ui-react/README.md:249-271; the wrapper is at :257-264). React still renders a display: none subtree on every store change. While a turn streams, the hidden transcript reconciles and re-parses its streaming message every animation frame. That competes with the Graph page, which is the heaviest view.

React 19.2 added <Activity mode="hidden">. It hides the subtree with display: none, keeps its state, and renders hidden updates at lower priority. It also unmounts the subtree's effects while hidden and re-creates them when shown. The lockfile resolves React 19.3.0, which exports Activity. The peer range stays >=18 (packages/ui-react/README.md:225-230), so React 18 shells need the current wrapper as a fallback.

ChatPage has 14 effects (packages/ui-react/src/components/chat/chat-page.tsx:128-572). Among them:

  • local-work registration (root.localWork?.register, :291)
  • the open-card wait and replay quiet timers (:523-572)
  • the tracker seen observer (useTrackerSeen, :361)

The Composer it renders has its own draft effects. Any of these might need to keep running while Chat is hidden, which <Activity> would stop.

(no guide)

Scope

  • Audit every effect in ChatPage and in the components it always renders (Composer, TrackerAnnouncer, HandoffSheet, StateRoomNotice). For each, record whether stopping it while Chat is hidden and re-running it on show is safe.
  • If all are safe, change the README example to use <Activity mode={activeView === "chat" ? "visible" : "hidden"}> on React 19.2 and later. Keep the display: contents/none wrapper as the documented React 18 fallback, with one sentence on what each costs.
  • If any effect must stay live, document that instead: leave the example as it is, and add a short note naming the effect and why <Activity> does not fit yet.

Out of scope

  • Changing ChatPage, its effects or any shipped component. Code changes found by the audit are filed separately.
  • The hosting template's own shell. If it copies this example, it needs its own issue in that repository.
  • Graph and Activity page mounting.

Acceptance criteria

  • The PR description lists every effect audited, as file:line, with "safe to stop while hidden" or "must stay live" and one line of reason each.
  • The README states the React version that <Activity> needs, checked against the installed react package rather than from memory, and keeps a working React 18 path.
  • If the example changes, a render test mounts the documented shell, streams a delta while Chat is hidden, switches back, and finds the transcript and scroll anchor intact.
  • A "must stay live" result closes this issue with the README note, and the issue filed for the blocking effect is linked.

Verification

bun run test packages/ui-react/tests
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

Documentation only. The README is shipped in the package, but no behaviour changes.

Activity

  1. added
    type: docs
    area: ui-react
    priority: p3
    agent-ready
    on Oct 22, 2026
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

    agent-readyarea: ui-reactpriority: p3type: docs

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions