Phase 20: Admin Member Editor & Form Declutter #25
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user