fix(settings): update cache immediately on save instead of invalidating
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
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:
@@ -834,10 +834,11 @@ function ProfileSection() {
|
|||||||
|
|
||||||
const saveMut = useMutation({
|
const saveMut = useMutation({
|
||||||
mutationFn: updateMyPreferences,
|
mutationFn: updateMyPreferences,
|
||||||
onSuccess: () => {
|
onSuccess: (updatedMe) => {
|
||||||
qc.invalidateQueries({ queryKey: ["me-prefs"] });
|
// Update cache immediately with the response — no extra round-trip needed
|
||||||
|
qc.setQueryData(["me-prefs"], updatedMe);
|
||||||
setDirty(false);
|
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" });
|
setToast({ msg: "Profile settings saved", type: "success" });
|
||||||
},
|
},
|
||||||
onError: () => setToast({ msg: "Failed to save", type: "error" }),
|
onError: () => setToast({ msg: "Failed to save", type: "error" }),
|
||||||
|
|||||||
Reference in New Issue
Block a user