From 51a4317440744767fe543399b77d625864a37057 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Sun, 12 Apr 2026 17:05:04 +0200 Subject: [PATCH] fix: optimistically remove dismissed app from sidebar cache Sets query cache immediately on dismiss success so the sidebar updates without waiting for the catalog refetch to complete. Co-Authored-By: Claude Opus 4.6 (1M context) --- ui/src/api/queries/catalog.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/api/queries/catalog.ts b/ui/src/api/queries/catalog.ts index d4d142d8..78aa216d 100644 --- a/ui/src/api/queries/catalog.ts +++ b/ui/src/api/queries/catalog.ts @@ -76,7 +76,11 @@ export function useDismissApp() { if (res.status === 409) throw new Error('Cannot dismiss — live agents are still connected'); if (!res.ok) throw new Error(`Failed to dismiss: ${res.status}`); }, - onSuccess: () => { + onSuccess: (_data, applicationId) => { + // Optimistically remove from cache before refetch + qc.setQueriesData({ queryKey: ['catalog'] }, (old) => + old ? old.filter((a) => a.slug !== applicationId) : old + ); qc.invalidateQueries({ queryKey: ['catalog'] }); }, });