Skip to content

feat: truncate roles display in member table with clickable expansion - #448

Open
rax7389 wants to merge 4 commits into
mainfrom
feat/tuncat-roles
Open

feat: truncate roles display in member table with clickable expansion#448
rax7389 wants to merge 4 commits into
mainfrom
feat/tuncat-roles

Conversation

@rax7389

@rax7389 rax7389 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Truncates the roles column in the member management table to show only the first 2 roles, with a clickable "+more" link that navigates to the member's roles tab for viewing all assigned roles.

Why

When members have many roles assigned, the roles column in the member table becomes cluttered and difficult to scan. This change improves table readability while maintaining easy access to full role details.

What

  • Truncate roles display to show first 2 roles with a "+more" button for overflow
  • Clicking "+more" navigates to the member detail view with the roles tab selected
  • Added memberRolesQuery to useMemberManagementService for fetching member roles
  • Added isValidUserId utility function for validation
  • Updated translations for new UI text
  • Added comprehensive test coverage for the new functionality

Packages

  • packages/core
  • packages/react
  • examples

Testing

Initial Load
image

When Clicked on +more
image

  • 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

Summary by CodeRabbit

New Features

  • Added a “View all” option for members with additional roles.
  • Member details can now open directly to the Details or Roles tab.
  • Added loading indicators while member roles are being retrieved.
  • Improved role assignment with preloaded role data for members with many roles.
  • Added English, French, and Japanese labels for expanded role lists.

Bug Fixes

  • Improved formatting in role-removal confirmations by clearly distinguishing member and role names.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a3aa9b51-4b3d-45f2-9f54-ed4f56db665e

📥 Commits

Reviewing files that changed from the base of the PR and between 7df09c6 and 9c16fbf.

📒 Files selected for processing (1)
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/__tests__/organization-member-assign-roles-modal.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/tests/organization-member-assign-roles-modal.test.tsx

📝 Walkthrough

Walkthrough

Member management now supports tab-aware detail actions, roles-tab navigation from the member table, validated member-role queries with prefetching, loading feedback in the assignment modal, updated translations, and expanded examples, tests, and documentation.

Changes

Member management flow

Layer / File(s) Summary
Tab-aware navigation contracts
packages/react/src/types/my-organization/member-management/*, packages/react/src/hooks/my-organization/use-member-detail.ts, packages/react/src/components/auth0/my-organization/organization-member-detail.tsx, docs-site/src/pages/MemberManagementDocs.tsx, examples/...
viewMemberDetailsAction now receives { userId, tab? }. Detail views initialize from the optional tab. Documentation and examples preserve the tab query parameter.
Member-role query and prefetch
packages/react/src/lib/utils/my-organization/member-management/*, packages/react/src/hooks/my-organization/shared/services/*, packages/react/src/hooks/my-organization/use-organization-member-management.ts, packages/react/src/lib/constants/..., packages/react/src/hooks/my-organization/__tests__/*
Member IDs use shared validation. Member roles load through memberRolesQuery, cache updates use memberManagementQueryKeys, and roles prefetch when the member has at least 10 roles.
Member table role navigation
packages/react/src/components/auth0/my-organization/shared/member-management/members/members-table/*, packages/react/src/components/auth0/my-organization/__tests__/organization-member-management.test.tsx, packages/core/src/i18n/translations/*.json
The table shows two roles and a localized “view all roles” button for additional roles. The button opens the roles tab without triggering the row action.
Role assignment loading and formatting
packages/react/src/components/auth0/my-organization/organization-member-management.tsx, packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/*, packages/react/src/components/auth0/my-organization/shared/member-management/organization-member-detail/organization-member-roles-tab.tsx, packages/react/src/types/..., packages/core/src/i18n/translations/*.json
The assignment modal displays a spinner while member roles load and uses fetched roles when available. Role-removal translations use separate role and member formatting placeholders.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MemberTable
  participant MemberManagement
  participant ViewMemberDetailsAction
  participant MemberDetail
  MemberTable->>MemberManagement: select member or view all roles
  MemberManagement->>ViewMemberDetailsAction: send { userId, tab? }
  ViewMemberDetailsAction->>MemberDetail: navigate with optional tab
  MemberDetail->>MemberDetail: initialize active tab
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: truncating roles in the member table and enabling clickable expansion.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tuncat-roles

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rax7389 rax7389 self-assigned this Aug 2, 2026
@rax7389 rax7389 added the enhancement New feature or request label Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

🚀 Preview deployment

Branch: refs/pull/448/merge
Commit: ed2dbbb

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


Updated at 2026-08-03T02:51:39.850Z

@codecov-commenter

codecov-commenter commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.90%. Comparing base (49bd1ec) to head (9c16fbf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
+ Coverage   90.86%   90.90%   +0.03%     
==========================================
  Files         239      239              
  Lines       17620    17671      +51     
  Branches     2467     2478      +11     
==========================================
+ Hits        16010    16063      +53     
+ Misses       1610     1608       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (4)
packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts (1)

541-618: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align the describe block naming with the stated test convention.

The new describe('memberRolesQuery', ...) block names the feature under test. As per coding guidelines, describe blocks should describe conditions using "when...", and it names should describe the action/outcome. Consider restructuring, for example nesting describe('when userId is invalid or the query is disabled', ...) and describe('when userId is valid and the query is enabled', ...), with it names stating the resulting behavior.

As per coding guidelines: "Use Vitest tests with describe/it naming: describe conditions with when... and describe actions in the it name."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts`
around lines 541 - 618, Restructure the memberRolesQuery tests so describe
blocks express conditions beginning with “when...”, rather than naming the
feature; group the disabled/absent/invalid userId cases separately from the
valid-and-enabled case, and update each it name to state the resulting fetch
behavior or query-key outcome.

Source: Coding guidelines

packages/react/src/components/auth0/my-organization/__tests__/organization-member-detail.test.tsx (1)

2-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Merge the duplicate package imports.

Line 2 adds a second import declaration from @auth0/universal-components-core. Merge it with the existing ComponentAction import.

As per coding guidelines: group imports by external package and internal imports, separate groups with newlines, and alphabetize imports within each group.

Proposed import consolidation
-import type { ComponentAction } from '`@auth0/universal-components-core`';
-import { memberManagementQueryKeys } from '`@auth0/universal-components-core`';
+import {
+  memberManagementQueryKeys,
+  type ComponentAction,
+} from '`@auth0/universal-components-core`';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/react/src/components/auth0/my-organization/__tests__/organization-member-detail.test.tsx`
at line 2, Merge the memberManagementQueryKeys import with the existing
ComponentAction import from `@auth0/universal-components-core`, keeping imports
grouped by package and alphabetized within the external-import group.

Source: Coding guidelines

packages/react/src/components/auth0/my-organization/organization-member-detail.tsx (1)

243-253: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression test for initialTab.

The new prop is forwarded to useOrganizationMemberDetail, but the provided tests do not exercise initialTab="roles". Add a component test that asserts the Roles tab is active before user interaction.

As per coding guidelines: add component tests for new React blocks and maintain at least 80% coverage.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/react/src/components/auth0/my-organization/organization-member-detail.tsx`
around lines 243 - 253, Add a component regression test for
OrganizationMemberDetail that renders with initialTab set to "roles" and
verifies the Roles tab is active before any user interaction. Reuse the existing
test setup and selectors for the component, and ensure the test covers the prop
forwarding through useOrganizationMemberDetail.

Source: Coding guidelines

packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/organization-member-assign-roles-modal.tsx (1)

93-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a component test for the role-loading branch.

When isLoadingRoles is true, the modal replaces the role selector with a spinner. Add a test that asserts the spinner is present and the combobox is absent.

As per coding guidelines: add component tests for new React blocks and maintain at least 80% coverage.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/organization-member-assign-roles-modal.tsx`
around lines 93 - 97, Add a component test for the role-loading branch in the
organization member roles modal, setting isLoadingRoles to true and asserting
that the spinner is rendered while the role-selector combobox is absent. Follow
the existing modal test setup and queries, and keep coverage at or above the
project’s 80% requirement.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/pages/MemberManagementDocs.tsx`:
- Around line 586-590: Update the Next.js example’s
viewMemberDetailsAction.onAfter handler to use the App Router-compatible
router.push href string, constructing the optional tab query with
URLSearchParams or equivalent while preserving navigation to /members/{userId}
when no tab is provided.

In `@packages/core/src/i18n/translations/en-US.json`:
- Line 1175: Update the view_all_roles placeholder from {{count}} to ${count} in
packages/core/src/i18n/translations/en-US.json lines 1175-1175,
packages/core/src/i18n/translations/fr.json lines 1110-1110, and
packages/core/src/i18n/translations/ja.json lines 1173-1173 so the translation
service substitutes the role count correctly.

In
`@packages/react/src/components/auth0/my-organization/shared/member-management/members/members-table/__tests__/organization-member-table-actions-column.test.tsx`:
- Line 91: Preserve the legacy string argument contract for
OrganizationMemberTableActionsColumnProps.onViewDetails and
handleViewMemberDetails so existing ComponentAction<string> consumers and
useMemberManagementServiceOptions.viewMemberDetailsAction remain
type-compatible; if tab-aware data is required internally, add an adapter or
typing guard at the boundary rather than changing the public callback signature.

In
`@packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/organization-member-remove-role-modal.tsx`:
- Around line 62-65: Update the translation components map in the organization
member remove-role modal to retain the legacy bold component alias alongside
roleBold and memberBold, preserving formatting for customMessages that still use
<bold>. Add a compatibility test verifying the legacy bold tag renders with
strong formatting.

In
`@packages/react/src/hooks/my-organization/use-organization-member-management.ts`:
- Around line 86-88: Document the invariant linking ROLES_PREFETCH_THRESHOLD to
the role truncation limit used by MEMBER_LIST_FIELDS, or derive the threshold
from that shared API limit instead of retaining an unexplained literal. Update
the selectedMemberRolesCount/memberRolesQuery flow so assignments at the
truncation boundary continue to prefetch complete roles.

In
`@packages/react/src/lib/utils/my-organization/member-management/__tests__/member-management-utils.test.tsx`:
- Around line 22-57: Rename the outer describe block for isValidUserId tests to
a condition-based name beginning with “when,” such as “when validating user
IDs,” while leaving the existing it descriptions and test behavior unchanged.

---

Nitpick comments:
In
`@packages/react/src/components/auth0/my-organization/__tests__/organization-member-detail.test.tsx`:
- Line 2: Merge the memberManagementQueryKeys import with the existing
ComponentAction import from `@auth0/universal-components-core`, keeping imports
grouped by package and alphabetized within the external-import group.

In
`@packages/react/src/components/auth0/my-organization/organization-member-detail.tsx`:
- Around line 243-253: Add a component regression test for
OrganizationMemberDetail that renders with initialTab set to "roles" and
verifies the Roles tab is active before any user interaction. Reuse the existing
test setup and selectors for the component, and ensure the test covers the prop
forwarding through useOrganizationMemberDetail.

In
`@packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/organization-member-assign-roles-modal.tsx`:
- Around line 93-97: Add a component test for the role-loading branch in the
organization member roles modal, setting isLoadingRoles to true and asserting
that the spinner is rendered while the role-selector combobox is absent. Follow
the existing modal test setup and queries, and keep coverage at or above the
project’s 80% requirement.

In
`@packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts`:
- Around line 541-618: Restructure the memberRolesQuery tests so describe blocks
express conditions beginning with “when...”, rather than naming the feature;
group the disabled/absent/invalid userId cases separately from the
valid-and-enabled case, and update each it name to state the resulting fetch
behavior or query-key outcome.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f0ec698-ee0e-4e6a-b39b-adbf75ce6f28

📥 Commits

Reviewing files that changed from the base of the PR and between 49bd1ec and ecdbc8e.

📒 Files selected for processing (26)
  • docs-site/src/pages/MemberManagementDocs.tsx
  • packages/core/src/i18n/translations/en-US.json
  • packages/core/src/i18n/translations/fr.json
  • packages/core/src/i18n/translations/ja.json
  • packages/react/src/components/auth0/my-organization/__tests__/organization-member-detail.test.tsx
  • packages/react/src/components/auth0/my-organization/__tests__/organization-member-management.test.tsx
  • packages/react/src/components/auth0/my-organization/organization-member-detail.tsx
  • packages/react/src/components/auth0/my-organization/organization-member-management.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/members-table/__tests__/organization-member-table-actions-column.test.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/members-table/__tests__/organization-member-table.test.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/members-table/organization-member-table-actions-column.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/members-table/organization-member-table.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/organization-member-assign-roles-modal.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/organization-member-remove-role-modal.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/organization-member-detail/organization-member-roles-tab.tsx
  • packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts
  • packages/react/src/hooks/my-organization/shared/services/use-member-detail-service.ts
  • packages/react/src/hooks/my-organization/shared/services/use-member-management-service.ts
  • packages/react/src/hooks/my-organization/use-member-detail.ts
  • packages/react/src/hooks/my-organization/use-organization-member-management.ts
  • packages/react/src/lib/constants/my-organization/member-management/member-management-constants.ts
  • packages/react/src/lib/utils/my-organization/member-management/__tests__/member-management-utils.test.tsx
  • packages/react/src/lib/utils/my-organization/member-management/member-management-utils.ts
  • packages/react/src/types/my-organization/member-management/organization-member-detail-types.ts
  • packages/react/src/types/my-organization/member-management/organization-member-management-types.ts
  • packages/react/src/types/my-organization/member-management/organization-member-table-types.ts

Comment thread docs-site/src/pages/MemberManagementDocs.tsx Outdated
Comment thread packages/core/src/i18n/translations/en-US.json Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/__tests__/organization-member-assign-roles-modal.test.tsx (1)

61-73: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a condition-based describe block for the loading test.

Move this test under describe('when isLoadingRoles is true', ...) and use an action-focused it name such as it('shows the loading state', ...). The current test is nested under describe('content').

As per coding guidelines, Vitest tests must describe conditions with when... and describe actions in the it name.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/__tests__/organization-member-assign-roles-modal.test.tsx`
around lines 61 - 73, Move the loading-state test from the existing content
describe block into a condition-based describe('when isLoadingRoles is true',
...) block, and rename the test to an action-focused name such as “shows the
loading state.” Preserve its current assertions and setup.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/react/src/types/my-organization/member-management/organization-member-detail-types.ts`:
- Line 18: Preserve the published MemberDetailTab API by adding a deprecated
alias to OrganizationMemberDetailTab in the member detail types, then
re-exporting MemberDetailTab from the package entry point. Keep
OrganizationMemberDetailTab as the current type and ensure existing consumers
importing MemberDetailTab continue to compile.

---

Nitpick comments:
In
`@packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/__tests__/organization-member-assign-roles-modal.test.tsx`:
- Around line 61-73: Move the loading-state test from the existing content
describe block into a condition-based describe('when isLoadingRoles is true',
...) block, and rename the test to an action-focused name such as “shows the
loading state.” Preserve its current assertions and setup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f37e2861-67ff-479c-ae4b-aa0aac192c13

📥 Commits

Reviewing files that changed from the base of the PR and between ecdbc8e and 7df09c6.

📒 Files selected for processing (18)
  • docs-site/src/pages/MemberManagementDocs.tsx
  • examples/next-rwa/src/app/member-management/[user_id]/page.tsx
  • examples/next-rwa/src/app/member-management/page.tsx
  • examples/react-spa-npm/src/views/member-detail-page.tsx
  • examples/react-spa-npm/src/views/member-management-page.tsx
  • examples/react-spa-shadcn/src/pages/MemberDetail.tsx
  • examples/react-spa-shadcn/src/pages/MemberManagement.tsx
  • packages/core/src/i18n/translations/en-US.json
  • packages/core/src/i18n/translations/fr.json
  • packages/core/src/i18n/translations/ja.json
  • packages/react/src/components/auth0/my-organization/__tests__/organization-member-detail.test.tsx
  • packages/react/src/components/auth0/my-organization/shared/member-management/members/organization-member-roles/__tests__/organization-member-assign-roles-modal.test.tsx
  • packages/react/src/hooks/my-organization/__tests__/use-member-management-service.test.ts
  • packages/react/src/hooks/my-organization/use-member-detail.ts
  • packages/react/src/lib/constants/my-organization/member-management/member-management-constants.ts
  • packages/react/src/lib/utils/my-organization/member-management/__tests__/member-management-utils.test.tsx
  • packages/react/src/types/my-organization/member-management/organization-member-detail-types.ts
  • packages/react/src/types/my-organization/member-management/organization-member-management-types.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • packages/core/src/i18n/translations/ja.json
  • packages/core/src/i18n/translations/en-US.json
  • packages/core/src/i18n/translations/fr.json
  • packages/react/src/components/auth0/my-organization/tests/organization-member-detail.test.tsx
  • packages/react/src/lib/constants/my-organization/member-management/member-management-constants.ts
  • packages/react/src/hooks/my-organization/tests/use-member-management-service.test.ts
  • packages/react/src/hooks/my-organization/use-member-detail.ts
  • packages/react/src/lib/utils/my-organization/member-management/tests/member-management-utils.test.tsx
  • docs-site/src/pages/MemberManagementDocs.tsx
  • packages/react/src/types/my-organization/member-management/organization-member-management-types.ts

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants