fix: optimistically remove dismissed app from sidebar cache
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m26s
CI / docker (push) Successful in 1m14s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 38s

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) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-12 17:05:04 +02:00
parent f84bdebd09
commit 51a4317440

View File

@@ -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<CatalogApp[]>({ queryKey: ['catalog'] }, (old) =>
old ? old.filter((a) => a.slug !== applicationId) : old
);
qc.invalidateQueries({ queryKey: ['catalog'] });
},
});