fix(settings): per-fact pending state on coach-memory forget

A single shared forgetOne mutation meant forgetOne.isPending disabled
every per-fact forget button during one delete, so the whole list read
as frozen. Track the in-flight fact id via the mutation variables so
only the row being deleted disables and shows the spinner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.8 committed 2026-06-04 13:26:00 +02:00
1 parent 2763a64b83
commit 9c39afa352
1 file changed
+18 -2
@@ -251,10 +251,26 @@ export function CoachMemorySection({
size="sm"
data-testid="settings-coach-memory-forget"
aria-label={t("settings.ai.coachMemory.forgetAria")}
disabled={!isAuthenticated || forgetOne.isPending}
// v1.11.2 — per-id pending: only the row being
// deleted disables/spins. `forgetOne.variables` holds
// the id passed to the in-flight `mutate()`, so a
// single shared mutation no longer greys out every
// other row's forget button during one delete.
disabled={
!isAuthenticated ||
(forgetOne.isPending && forgetOne.variables === fact.id)
}
onClick={() => forgetOne.mutate(fact.id)}
>
<Trash2 className="size-4" aria-hidden />
{forgetOne.isPending &&
forgetOne.variables === fact.id ? (
<Loader2
className="size-4 animate-spin motion-reduce:animate-none"
aria-hidden
/>
) : (
<Trash2 className="size-4" aria-hidden />
)}
{t("settings.ai.coachMemory.forget")}
</Button>
</li>