From f38ceae3fb6c95426413fc195869205ab239d040 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Sat, 17 Oct 2026 08:10:16 +0800 Subject: [PATCH] fix(profiles): restore single switch error toast and refetch after busy patchProfiles entered the mutate funnel without errorNotice:false, so a failed switch toasted twice. On busy the cached current profile was left untouched, so a discarded switch draft could poison later clicks on the target profile. Refetch on every non-valid outcome. --- src/hooks/use-profiles.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hooks/use-profiles.ts b/src/hooks/use-profiles.ts index 2ebbd3c2a..f07fd4ce0 100644 --- a/src/hooks/use-profiles.ts +++ b/src/hooks/use-profiles.ts @@ -51,6 +51,7 @@ export const useProfiles = () => { try { const result = await mutate(() => patchProfilesConfig(value), { id: 'patch-profiles-config', + errorNotice: false, onFulfilled: (outcome) => { if (outcome.status === 'valid') { void setCacheData(profilesQueryKey, (current) => @@ -60,12 +61,8 @@ export const useProfiles = () => { }, }) - if (!result.ok) { - // Backend Busy keeps local state untouched, as before. - return result.value - } const outcome = result.value - if (outcome.status !== 'valid' && outcome.status !== 'busy') { + if (outcome.status !== 'valid') { await mutateProfiles() } return outcome