fix(webui): delete unpersisted pane sessions (#5624)

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
This commit is contained in:
Kail Tian
2026-09-02 13:05:36 +08:00
committed by GitHub
co-authored by chengyongru
parent 9ecdc4533f
commit 042f96f6ba
5 changed files with 108 additions and 3 deletions
+5 -2
View File
@@ -257,11 +257,14 @@ export function useSessions(): {
const deleteChat = useCallback(
async (key: string, options?: { deleteAutomations?: boolean }) => {
const optimistic = optimisticKeysRef.current.has(key);
const result = await apiDeleteSession(client, key, options);
if (!result.deleted) return result;
if (result.blocked_by_automations || (!result.deleted && !optimistic)) return result;
optimisticKeysRef.current.delete(key);
setSessions((prev) => prev.filter((s) => s.key !== key));
return result;
// The gateway may have restarted and forgotten an unpersisted chat's
// draft scope, but removing that optimistic session is still a deletion.
return result.deleted ? result : { ...result, deleted: true };
},
[client],
);