Skip to content

SDK regression: views-new member role-change still uses raw policy CRUD #1610

@whoAbhishekSah

Description

@whoAbhishekSah

Where

web/sdk/react/views-new/members/components/update-role-dialog.tsx

Problem

The new members page dialog still changes an org member's role by:

  1. listPolicies({ orgId, userId })
  2. deletePolicy per existing policy
  3. createPolicy against app/organization: with the new role

The dedicated RPC SetOrganizationMemberRole should be used instead — same pattern as the legacy view migration in #1477.

How it happened

Same flavor of drift fixed for groups in #1608 / #1609.

Suggested fix

Replace useQuery(listPolicies) + useMutation(deletePolicy) + useMutation(createPolicy) with a single useMutation(setOrganizationMemberRole). Drop the unused schemas/types.

const { mutateAsync: setOrgMemberRole } = useMutation(
  FrontierServiceQueries.setOrganizationMemberRole
);

await setOrgMemberRole(create(SetOrganizationMemberRoleRequestSchema, {
  orgId: organizationId,
  userId: payload.memberId,
  roleId: payload.role.id,
}));

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions