From 4b2770a00077d40ba52bcd34e72eeb69d5ea7936 Mon Sep 17 00:00:00 2001 From: BOHA Date: Mon, 8 Jun 2026 21:22:31 +0200 Subject: [PATCH] fix(odin): show conversation auto-title immediately (no refresh needed) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ensureActive() created the conversation and invalidated the list before the server-side auto-title was applied (that happens on the message append), so the sidebar showed "Nová konverzace" until a refresh. Move the ["ai","conversations"] invalidation to persist()'s success path — after the append (and thus the auto-title) lands. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/admin/components/odin/OdinChat.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/admin/components/odin/OdinChat.tsx b/src/admin/components/odin/OdinChat.tsx index cdf85f1..5e71e0c 100644 --- a/src/admin/components/odin/OdinChat.tsx +++ b/src/admin/components/odin/OdinChat.tsx @@ -153,6 +153,9 @@ export default function OdinChat() { }) .then((r) => { if (!r.ok) return r.json().then((b) => Promise.reject(b?.error)); + // The append applies the server-side auto-title and bumps updated_at, + // so refresh the list now (a new conversation gets its real title here). + qc.invalidateQueries({ queryKey: ["ai", "conversations"] }); }) .catch((e) => console.error("[odin] history persist failed", e)); }; @@ -191,7 +194,8 @@ export default function OdinChat() { const id = b.data.conversation.id as number; seededId.current = id; setActiveId(id); - qc.invalidateQueries({ queryKey: ["ai", "conversations"] }); + // Don't refresh the list yet — the conversation is still the default + // "Nová konverzace" here; persist() invalidates after the auto-title lands. return id; };