Skip to content

fix(react): invalidate members query on role change#332

Open
chakrihacker wants to merge 1 commit into
feat/member-managementfrom
fix/roles-invalidate-query
Open

fix(react): invalidate members query on role change#332
chakrihacker wants to merge 1 commit into
feat/member-managementfrom
fix/roles-invalidate-query

Conversation

@chakrihacker
Copy link
Copy Markdown
Contributor

Summary

Fix stale roles on the Member List page after modifying a member's roles in the Member Detail view.

Why

When a user added or removed roles on the Member Detail page and navigated back, the Member List still showed the old roles. The assignRolesMutation and removeRolesMutation in use-member-detail-service.ts only invalidated the detail-page's own memberDetailQueryKeys.memberRoles cache, leaving the memberManagementQueryKeys.members() cache (which embeds inline roles in each list row) stale

What

  • assignRolesMutation.onSuccess and removeRolesMutation.onSuccess in use-member-detail-service.ts now additionally call queryClient.invalidateQueries({ queryKey: memberManagementQueryKeys.members() }), mirroring the pattern already used by removeFromOrgMutation
  • Two new tests in organization-member-detail.test.tsx assert that invalidateQueries is called with memberManagementQueryKeys.members() after both assign and remove role mutations succeed

Packages

  • packages/core
  • packages/react
  • examples

Testing

How can this be verified? Note anything intentionally not covered by tests and why.

  1. Start the react-spa-npm example app.
  2. Navigate to Organization → Members.
  3. Click a member row to open the Member Detail view.
  4. Go to the Roles tab, assign or remove a role.
  5. Click Go back — the Member List should immediately reflect the updated roles for that member.
  • This change adds unit test coverage
  • Tested for both SPA and RWA flows, all example apps working
  • All existing and new tests complete without errors

Checklist

  • Breaking change
  • Requires docs update
  • Backward compatible

Contributing

@chakrihacker chakrihacker changed the base branch from main to feat/member-management June 5, 2026 18:47
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

🚀 Preview deployment

Branch: refs/pull/332/merge
Commit: 016d158

📝 Preview URL: https://auth0-universal-components-fvu6o4g35-ui-components-217de888.vercel.app


Updated at 2026-06-05T18:48:17.997Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants