diff --git a/frontend/src/routes/settings/Settings.tsx b/frontend/src/routes/settings/Settings.tsx index 6957bb3..8fa3cc0 100644 --- a/frontend/src/routes/settings/Settings.tsx +++ b/frontend/src/routes/settings/Settings.tsx @@ -389,6 +389,7 @@ function AccountEditor({ onSaved: () => void; }) { const t = useT(); + const queryClient = useQueryClient(); const detail = useQuery({ queryKey: ["account", accountId], queryFn: () => api.accountDetail(accountId) }); const [displayName, setDisplayName] = useState(""); const [color, setColor] = useState("#888888"); @@ -428,7 +429,10 @@ function AccountEditor({ } return api.updateAccount(accountId, patch); }, - onSuccess: onSaved, + onSuccess: (updated) => { + queryClient.setQueryData(["account", accountId], updated); + onSaved(); + }, onError: (e) => setError(e instanceof ApiError ? e.message : "Save failed"), }); @@ -519,6 +523,7 @@ function SignatureEditor({ onSaved: () => void; }) { const t = useT(); + const queryClient = useQueryClient(); const detail = useQuery({ queryKey: ["account", accountId], queryFn: () => api.accountDetail(accountId), @@ -532,7 +537,12 @@ function SignatureEditor({ const save = useMutation({ mutationFn: () => api.updateAccount(accountId, { signature }), - onSuccess: onSaved, + // Keep the cached detail current: the editor seeds from it only once on mount, + // so a stale entry would reopen the editor with the old (e.g. empty) signature. + onSuccess: (updated) => { + queryClient.setQueryData(["account", accountId], updated); + onSaved(); + }, onError: (e) => setError(e instanceof ApiError ? e.message : "Save failed"), });