-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Added scroll state support for chat-session-list navigation #4360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added scroll state support for chat-session-list navigation #4360
Conversation
0e9c9bc to
19216df
Compare
zanesq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! Couple of notes:
- It doesn't seem to respect the scroll after searching, it just goes back to the top when I hit back (see below). I don't think this is a blocker since the general back scroll position without search is a valuable feature but if that was the intent just wanted to point it out.
Kapture.2025-08-27.at.08.54.53.mp4
- Using mutation observer is not ideal, we'd rather stick with react way of doing things. MutationObserver is typically a workaround for situations where you don’t have direct control over the DOM updates (such as with third-party libraries or dynamic content outside React’s control).
Can you change it to use refs instead something like
import React, { useEffect, useRef } from "react";
function SessionListView({ sessions, selectedSessionId, ...props }) {
const sessionRefs = useRef({});
useEffect(() => {
if (selectedSessionId && sessionRefs.current[selectedSessionId]) {
sessionRefs.current[selectedSessionId].scrollIntoView({
block: "center",
behavior: "smooth",
});
}
}, [selectedSessionId, sessions]); // or filteredSessions if applicable
return (
<div>
{sessions.map(session => (
<Card
key={session.id}
ref={el => {
// Store ref for each session card
sessionRefs.current[session.id] = el;
}}
// ...other props
>
{/* ... */}
</Card>
))}
</div>
);
}
|
Thank you for the review! I'll go ahead and make your suggested changes.
I actually wanted to have a separate follow up to preserve the search-filter on back which would make it easier to reuse this scroller.
Got it! I'm still getting a handle on react so I appreciate the heads up. |
|
I went ahead and pushed up the suggested changes:
|
c331f3d to
c1eeb6c
Compare
* main: (38 commits) feat: linux computer control for android (termux) (#3890) feat: Added scroll state support for chat-session-list navigation (#4360) docs: typo fix (#4376) blog: goose janitor (#4131) Fix eleven labs audio transcription and added more logging (#4358) feat: re-introduce session sharing (#4370) remove duplicate blog post (#4369) fix focus ring under form submits (#4332) Trigger docs deployment update tetrate blog date to today (#4368) tetrate signup: blog/launch post (#4313) Implement graceful recipe error handling with filename display (#4363) docs: airgapped operation by bypassing hermit for desktop app (#4063) remove Ollama card from welcome screen (#4348) feat: initial implementation of extension malware check (#4272) Add Tetrate Agent Router Service to Provider Registry (#4354) Goose Simple Compact UX (#4202) Refactor Extensions Install Modal (#4328) fix: url path trailing slash for custom-providers (#4345) docs: update available and onboarding providers list (#4356) ...
* main: (40 commits) new recipe to lint-check my code (#4416) removing a leftover syntax error (#4415) Iand/updating recipe validation workflow (#4413) Iand/updating recipe validation workflow (#4410) Fix (Ollama provider): Unsupported operation: streaming not implemented (#4303) change databricks default to claude sonnet 4 (#4405) Iand/updating recipe validation workflow (#4406) Add metrics for recipe metadata in scheduler, UI, and CLI (#4399) Iand/updating recipe validation workflow (#4403) making small updates to recipe validation workflow (#4401) Automate OpenRouter API Key Distribution for External Recipe Contributors (#3198) Enhance `convert_path_with_tilde_expansion` to handle Windows (#4390) make sure all cookbook recipes have a title and version, but no id (#4395) Nest TODO State in session data (#4361) Fast model falls back to regular (#4375) Update windows instructions (#4333) feat: linux computer control for android (termux) (#3890) feat: Added scroll state support for chat-session-list navigation (#4360) docs: typo fix (#4376) blog: goose janitor (#4131) ...
…ock#4360) Signed-off-by: Dorien Koelemeijer <dkoelemeijer@squareup.com>
Summary
Added scroll state memory when navigating back from session view. This works for filtered search results as well.
Changes
showSessionHistoryto SessionsView to replace reliance onselectedSessionbeing nullselectedSessionas a new prop toSessionListViewso that it can scroll to a selected sessionuseEffectwithMutationObserverto detect and scroll to selected session when loaded.Request
#3664
After Changes
Screen.Recording.2025-08-26.at.2.03.27.PM.mov
NOTE
Previous PR was closed out due to staleness. Comments were addressed in this pr