fix(chat): keep the outgoing conversation still until the next one replaces it

Switching sessions moved the conversation on screen before the swap: the
composer and the status chip followed the live selection and re-shaped a
commit ahead of the timeline, so the pinned outgoing chat jumped; and the
reveal effect re-ran for the outgoing session when its waited flag flipped,
hiding it a few frames before the next one mounted. The chat column now
reads one deferred session, and the reveal runs once per opened session.
This commit is contained in:
Bohdan Triapitsyn
2026-08-30 16:54:41 +03:00
parent 02b1ee637d
commit 654b3d2441
5 changed files with 61 additions and 6 deletions
+9 -2
View File
@@ -1,4 +1,5 @@
import React from 'react';
import { useChatColumnSession } from '@/components/chat/chatColumnSession';
import type { Message, Part, ReasoningPart, TextPart, ToolPart } from '@opencode-ai/sdk/v2';
import type { MessageStreamPhase } from '@/stores/types/sessionTypes';
@@ -301,8 +302,14 @@ export const getActiveAssistantContext = (messages: Message[]): ActiveAssistantC
};
export function useAssistantStatus(): AssistantStatusSnapshot {
const currentSessionId = useSessionUIStore((state) => state.currentSessionId);
const currentSessionDirectory = useSessionUIStore((state) => state.currentSessionDirectory);
// Inside the chat column, follow the session the timeline shows rather
// than the live selection, so the status chip changes together with the
// conversation instead of a commit ahead of it.
const chatColumnSession = useChatColumnSession();
const liveSessionId = useSessionUIStore((state) => state.currentSessionId);
const liveSessionDirectory = useSessionUIStore((state) => state.currentSessionDirectory);
const currentSessionId = chatColumnSession ? chatColumnSession.sessionId : liveSessionId;
const currentSessionDirectory = chatColumnSession ? chatColumnSession.directory : liveSessionDirectory;
const rawSessionMessages = useSessionMessages(
currentSessionId ?? '',