diff --git a/src/staff/utils.ts b/src/staff/utils.ts index 3a635af8b..70b65362e 100644 --- a/src/staff/utils.ts +++ b/src/staff/utils.ts @@ -7,9 +7,13 @@ import { StaffDetailsFormData } from "./components/StaffDetailsPage"; * Return lists of groups which have to be added and removed from user. */ export const groupsDiff = ( - user: StaffMemberDetailsFragment, + user: StaffMemberDetailsFragment | undefined, formData: StaffDetailsFormData, ) => { + if (!user) { + return {}; + } + const newGroups = formData.permissionGroups; const oldGroups = user.permissionGroups.map(u => u.id);