fix(odin): show conversation auto-title immediately (no refresh needed)
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user