fix(frontend): Scroll new session tab into view in agent playground - #5112
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughSessionTagBar now auto-scrolls the active session chip into view inside the horizontal session strip, and the strip uses smooth scrolling when motion is allowed. ChangesSession tag auto-scroll
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/oss/src/components/AgentChatSlice/components/SessionTagBar.tsx (1)
71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: extract shared reduced-motion helper.
The
window.matchMedia("(prefers-reduced-motion: reduce)").matchescheck duplicates the pattern already used inAgentChatPanel.tsx'sanimatePinTo. Consider extracting a tiny sharedprefersReducedMotion()utility to avoid drift between the two implementations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8f47c94e-27a4-49a4-94d9-e64c9fff7215
📒 Files selected for processing (1)
web/oss/src/components/AgentChatSlice/components/SessionTagBar.tsx
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/oss/src/components/AgentChatSlice/components/SessionTagBar.tsx (1)
66-74: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRe-run the scroll when the bar becomes visible
scrollIntoView()can run while the tab strip is still collapsed (for example during onboarding), and then never runs again when the strip expands because onlyactiveis in the dependency list. Include the visibility state (chromeHidden/chatMaximized) or another “became visible” signal so the active chip is scrolled into view after reveal.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ceaa9ce1-dcd1-4be0-8435-715f6818debb
📒 Files selected for processing (1)
web/oss/src/components/AgentChatSlice/components/SessionTagBar.tsx
Context
In the agent playground, the session tab bar scrolls horizontally once there are more tabs than fit. Creating a new session appends its tab at the end of the strip and makes it active, but nothing scrolled the strip. With enough open sessions the new tab landed past the overflow edge, invisible, so it looked like nothing happened.
Changes
Each session tab in
SessionTagBarnow scrolls itself into view when it becomes active. Since a new session is always created active, this brings the fresh tab into focus; it also fixes the same blind spot when reopening an off-screen session from the history menu, and when the bar mounts with the active tab out of view.The scroll uses
block: "nearest"andinline: "nearest"so it only nudges the horizontal strip and never scrolls the page vertically, and falls back from smooth to instant when the user prefers reduced motion.Tests / notes
nearestis a no-op when the tab is already visible).SessionRailis untouched: it inserts new sessions at the top, so they are visible unless the list is scrolled down.What to QA