Skip to content

Conversation

@dhairyashiil
Copy link
Member

Overview

This PR refactors the organization members page implementation to eliminate significant code duplication between the new main navigation route (/members) and the existing settings route (/settings/organizations/members).

Changes

  • Extracted Shared Logic: Created apps/web/modules/members/getOrgMembersPageData.ts to house server-side data fetching, caching strategies, and permission checks.
  • Refactored Pages: Updated both (main-nav)/members/page.tsx and settings/.../members/page.tsx to consume the new shared module.

Technical Details

  • Moved getCachedAttributes, getCachedRoles, elaborate permission logic (~50 lines), and facetedTeamValues construction into the reusable function.
  • Reduced the size of each page file from ~155 lines to ~45 lines.
  • No functional changes: The behavior, permissions, and UI remain exactly the same; this is purely a code structure improvement.

- Extract data fetching, coaching, and permission logic into [getOrgMembersPageData.ts](cci:7://file:///Users/dhairyashilshinde/work/cal.com/apps/web/modules/members/getOrgMembersPageData.ts:0:0-0:0)
- Deduplicate logic between [/members](cci:7://file:///Users/dhairyashilshinde/work/cal.com/apps/web/app/%28use-page-wrapper%29/%28main-nav%29/members:0:0-0:0) and  pages
- Reduce page component size and improve maintainability
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jan 22, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/modules/members/getOrgMembersPageData.ts">

<violation number="1" location="apps/web/modules/members/getOrgMembersPageData.ts:36">
P2: Guard against `listCurrent()` returning null before accessing `org.id` or `org.isPrivate` to avoid a runtime crash for users without an org.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link
Contributor

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

@dhairyashiil dhairyashiil merged commit e473ab4 into devin/1768910823-refactor-members-route Jan 22, 2026
14 checks passed
@dhairyashiil dhairyashiil deleted the refactor/org-members-route branch January 22, 2026 22:31
dhairyashiil added a commit that referenced this pull request Jan 22, 2026
…/members to /members (#27053)

* refactor: move organization members page from /settings/organizations/members to /members

- Create new /members route under main-nav with same functionality
- Add permanent redirect from /settings/organizations/members to /members
- Include loading skeleton and server actions for the new route

Co-Authored-By: peer@cal.com <peer@cal.com>

* refactor: Deduplicate organization members page logic (#27168)

* refactor(web): extract shared org members data fetching logic

- Extract data fetching, coaching, and permission logic into [getOrgMembersPageData.ts](cci:7://file:///Users/dhairyashilshinde/work/cal.com/apps/web/modules/members/getOrgMembersPageData.ts:0:0-0:0)
- Deduplicate logic between [/members](cci:7://file:///Users/dhairyashilshinde/work/cal.com/apps/web/app/%28use-page-wrapper%29/%28main-nav%29/members:0:0-0:0) and  pages
- Reduce page component size and improve maintainability

* safe guard for org id null

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Created by Linear-GitHub Sync size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants