fix(20): IN-04 skip profile-saved toast + refetch on no-op save

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lucas Berger
2026-06-18 18:22:29 -04:00
co-authored by Claude Opus 4.8
parent 5240f1e503
commit 5161bd39c2
@@ -270,11 +270,15 @@ export function MemberEditorSheet({
payload.displayName = trimmed;
}
if (isAdmin !== member.isAdmin) payload.isAdmin = isAdmin;
// No-op guard — nothing changed, skip the network call
if (Object.keys(payload).length === 0) return;
// No-op guard — nothing changed, skip the network call and signal no write
// (IN-04: avoids firing the "Profile saved." toast + refetch on a no-op save).
if (Object.keys(payload).length === 0) return false;
await updateMemberProfile(member.id, payload);
return true;
},
onSuccess: () => {
onSuccess: (changed) => {
// IN-04: only surface success feedback when an actual write occurred.
if (!changed) return;
void queryClient.invalidateQueries({ queryKey: ['admin', 'members'] });
onToast('Profile saved.');
// Sheet stays open — per-section save (D-05)