Skip to content

Agentic UI: Fix chat opening at the top after a cold start - #4823

Open
shaunandrews wants to merge 1 commit into
trunkfrom
fix-chat-scroll-on-cold-start
Open

Agentic UI: Fix chat opening at the top after a cold start#4823
shaunandrews wants to merge 1 commit into
trunkfrom
fix-chat-scroll-on-cold-start

Conversation

@shaunandrews

Copy link
Copy Markdown
Contributor

Related issues

  • None

How AI was used in this PR

  • Claude Code diagnosed the regression, wrote the fix and the regression test; diff reviewed by hand.

Proposed Changes

  • On a cold start, Studio opened the most recent chat scrolled to the top, and the scroll-to-latest button never appeared, even after scrolling up.
  • Cause: the session is served from the persisted query cache before the AI-credits quota check resolves, so the conversation scroller mounts in a later render than the session data. The scroll effects ran once against a not-yet-mounted scroller and never re-ran. Regression from the quota gate in Surface Studio Code payment-method requirement before the first prompt #4422 landing on top of the autoscroll pause in Agentic UI: pause chat autoscroll while reading earlier messages #4575.
  • The scroll effects now key off the scroller itself, so the chat opens at the latest message and the button works regardless of which query resolves first. The same path covers the payment-method gate → chat transition.

Testing Instructions

  1. Quit Studio fully and relaunch so the quota query is cold.
  2. The most recent chat opens scrolled to the latest message.
  3. Scroll up: the scroll-to-latest button appears. Click it to return to the bottom.
  4. Switch sessions and repeat.
  5. npm test -- apps/ui/src/ui-classic/components/session-view/index.test.tsx — the new cold-start case fails on trunk and passes here.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

…on after a cold start

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 3a0232e vs trunk

app-size

Metric trunk 3a0232e Diff Change
App Size (Mac) 1456.84 MB 1456.84 MB 0.00 MB ⚪ 0.0%

site-editor

Metric trunk 3a0232e Diff Change
load 1192 ms 1186 ms 6 ms ⚪ 0.0%

site-startup

Metric trunk 3a0232e Diff Change
siteCreation 7523 ms 7589 ms +66 ms 🔴 0.9%
siteStartup 3373 ms 3370 ms 3 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants