[eric] frontend: stop the session-list poll from clobbering live chat messages, fixes the user bubble vanishing on click-out/in

This commit is contained in:
ciregenz
2026-06-09 02:51:40 -07:00
parent e24a63c13c
commit 8159d79c4a
+7
View File
@@ -1031,6 +1031,13 @@ const agentsSlice = createSlice({
const existing = state.sessions[s.id];
state.sessions[s.id] = {
...s,
// This is a METADATA poll (status/name); the chat owns its messages
// via fetchSession + the WS stream. A poll response computed before a
// just-sent user turn must NOT clobber the live array, that intermittently
// wiped the user's own bubble (while the assistant stream, a separate
// slice, kept rendering). Keep the hydrated messages; only adopt the
// poll's copy for a session we haven't loaded into the chat yet.
messages: existing?.messages?.length ? existing.messages : s.messages ?? [],
pending_approvals: existing?.pending_approvals?.length
? existing.pending_approvals
: s.pending_approvals ?? [],