fix(settings): update cache immediately on save instead of invalidating
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

Using setQueryData with the PATCH response means jira_token_set is
reflected in the UI instantly — no extra GET round-trip that could
leave the badge stale.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kitos
2026-05-26 17:20:40 +02:00
parent fd4a625760
commit 513a7b488b

View File

@@ -834,10 +834,11 @@ function ProfileSection() {
const saveMut = useMutation({
mutationFn: updateMyPreferences,
onSuccess: () => {
qc.invalidateQueries({ queryKey: ["me-prefs"] });
onSuccess: (updatedMe) => {
// Update cache immediately with the response — no extra round-trip needed
qc.setQueryData(["me-prefs"], updatedMe);
setDirty(false);
setJiraApiToken(""); // clear token field after save — it's now persisted
setJiraApiToken(""); // clear token field after save — it's persisted
setToast({ msg: "Profile settings saved", type: "success" });
},
onError: () => setToast({ msg: "Failed to save", type: "error" }),