Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(react): preserve top anchor reserve between turns#5085

Open
Gujiassh wants to merge 2 commits into
assistant-ui:mainassistant-ui/assistant-ui:mainfrom
Gujiassh:fix/preserve-top-anchor-reserve-5038Gujiassh/assistant-ui:fix/preserve-top-anchor-reserve-5038Copy head branch name to clipboard
Open

fix(react): preserve top anchor reserve between turns#5085
Gujiassh wants to merge 2 commits into
assistant-ui:mainassistant-ui/assistant-ui:mainfrom
Gujiassh:fix/preserve-top-anchor-reserve-5038Gujiassh/assistant-ui:fix/preserve-top-anchor-reserve-5038Copy head branch name to clipboard

Conversation

@Gujiassh

@Gujiassh Gujiassh commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve the existing top-anchor reserve while an external runtime is between turns and the next anchor has not mounted yet
  • move the preserved reserve after optimistic content, then let the next active target reposition and resize it
  • keep cleanup when top anchoring is disabled, the viewport disappears, or the reserve effect unmounts

Fixes #5038.

Validation

  • added a current-main red regression that observed the reserve being disconnected during the between-turns gap
  • focused reserve lifecycle tests pass (5/5), covering the gap, next target, bottom mode, viewport loss, and unmount
  • complete @assistant-ui/react suite passes (44 files, 459 tests)
  • @assistant-ui/react production build passes (928 entries)
  • root lint and format checks pass with existing warnings

Standalone package tsc --noEmit still reports the existing ComposerRoot.test.tsx setMultiline diagnostics on current main; this change does not touch that test.

Review in cubic

@Gujiassh
Gujiassh requested a review from a team July 21, 2026 06:00
@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

馃 Changeset detected

Latest commit: 5ac02d6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@assistant-ui/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rupic-app rupic-app Bot added stage/needs-review No reviews yet; waiting for a maintainer pkg/react Changes a package under packages/ R0 Act now: stale, blocked, or high impact type/bugfix Bug fix labels Jul 21, 2026
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(react): preserve top anchor reserve ..." | Re-trigger Greptile

Comment on lines +74 to +78
if (!anchor || !target || !clamp) {
observers.disconnect();
if (reserve?.parentElement) reserve.parentElement.append(reserve);
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Partial Unmount Retains Stale Space

When the registered user message unmounts independently while the target and viewport remain mounted, anchor becomes null through its separate registration callback. This branch now preserves the old reserve height indefinitely rather than treating that state as cleanup, leaving blank space in the thread until another complete target pair is registered.

@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed and removed stage/needs-review No reviews yet; waiting for a maintainer labels Jul 21, 2026
@rupic-app rupic-app Bot added R1 Actionable, normal priority and removed R0 Act now: stale, blocked, or high impact labels Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/react Changes a package under packages/ R1 Actionable, normal priority stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed type/bugfix Bug fix

Projects

None yet

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.