diff --git a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesConfirmationModal.tsx b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesConfirmationModal.tsx index d5e6066708c..1756678bdc9 100644 --- a/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesConfirmationModal.tsx +++ b/apps/studio/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesConfirmationModal.tsx @@ -100,28 +100,28 @@ export const UpdateRolesConfirmationModal = ({ const { toRemove, toAssign, toUpdate } = deriveRoleChangeActions(existingRoles, changesToRoles) try { - await Promise.all([ - ...toAssign.map(({ roleId, projectIds }) => - assignRole({ - slug, - gotrueId, - roleId, - projects: projectIds.map((id) => projects?.find((p) => p.id === id)?.ref) as string[], - }) - ), - ]) - await Promise.all([ - ...toRemove.map((roleId) => removeRole({ slug, gotrueId, roleId })), - ...toUpdate.map(({ roleId, projectIds }) => - updateRole({ - slug, - gotrueId, - roleId, - roleName: project_scoped_roles.find((r) => r.id === roleId)?.name as string, - projects: projectIds.map((id) => projects?.find((p) => p.id === id)?.ref) as string[], - }) - ), - ]) + for (const { roleId, projectIds } of toAssign) { + await assignRole({ + slug, + gotrueId, + roleId, + projects: projectIds.map((id) => projects?.find((p) => p.id === id)?.ref) as string[], + skipInvalidation: true, + }) + } + for (const roleId of toRemove) { + await removeRole({ slug, gotrueId, roleId, skipInvalidation: true }) + } + for (const { roleId, projectIds } of toUpdate) { + await updateRole({ + slug, + gotrueId, + roleId, + roleName: project_scoped_roles.find((r) => r.id === roleId)?.name as string, + projects: projectIds.map((id) => projects?.find((p) => p.id === id)?.ref) as string[], + skipInvalidation: true, + }) + } await Promise.all([ queryClient.invalidateQueries(organizationKeys.rolesV2(slug)),