fix: prevent live chat from snapping to latest

Keeps manual scroll position during active sessions
Avoids forced resume after missing chat data recovery
This commit is contained in:
Bohdan Triapitsyn
2026-05-07 23:03:46 +03:00
parent 0b0bb11d36
commit d5b3590901
@@ -787,7 +787,9 @@ export const ChatContainer: React.FC = () => {
const statusType = sessionStatusForCurrent.type ?? 'idle';
const isActivePhase = statusType === 'busy' || statusType === 'retry';
const hasHashTarget = typeof window !== 'undefined' && window.location.hash.length > 0;
const shouldSkipScroll = hasHashTarget || (isActivePhase && isPinned);
// Active sessions are already followed by the scroll manager when pinned.
// If the user scrolled away, a materialization retry must not force-resume.
const shouldSkipScroll = hasHashTarget || isActivePhase;
if (!shouldSkipScroll) {
if (typeof window === 'undefined') {
@@ -802,7 +804,7 @@ export const ChatContainer: React.FC = () => {
};
void load();
}, [currentSessionId, ensureSessionRenderable, hasRenderableSessionSnapshot, isPinned, resumeToLatestInstant, sessionStatusForCurrent.type]);
}, [currentSessionId, ensureSessionRenderable, hasRenderableSessionSnapshot, resumeToLatestInstant, sessionStatusForCurrent.type]);
if (!currentSessionId && !draftOpen) {
return (