Skip to content

refactor: Remove trpc/react dependency from @calcom/atoms#39

Open
tomerqodo wants to merge 8 commits intocoderabbit_full_base_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr12from
coderabbit_full_head_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr12
Open

refactor: Remove trpc/react dependency from @calcom/atoms#39
tomerqodo wants to merge 8 commits intocoderabbit_full_base_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr12from
coderabbit_full_head_refactor_remove_trpc_react_dependency_from_calcom_atoms_pr12

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 29, 2026

Benchmark PR from agentic-review-benchmarks#12

Summary by CodeRabbit

  • New Features

    • Added loading state indicator when fetching team members data.
  • Refactor

    • Improved type safety for travel schedule data handling.
    • Reorganized internal hook structure for better code maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

This PR reorganizes team member segment hooks by relocating useTeamMembersWithSegment from the atoms package to web modules, establishing separate platform-specific and web-specific implementations. Additional changes include updated type signatures for travelSchedules, import restrictions in configuration, and component updates to utilize the reorganized hooks.

Changes

Cohort / File(s) Summary
Hook Reorganization
apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx, packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx
New web-specific hook created that performs TRPC query and data processing. Platform hook refactored to export shared utilities (UseTeamMembersWithSegmentProps, useProcessTeamMembersData) while removing the main hook function.
Component Integration
apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx
Updated to import and use new hook structure, switched from filteredMembers to teamMembers, added isPending state handling.
Type Updates
packages/platform/atoms/availability/AvailabilitySettings.tsx
Changed travelSchedules prop type from TRPC RouterOutputs to concrete Awaited<ReturnType<typeof TravelScheduleRepository.findTravelSchedulesByUserId>>.
Configuration & Exports
biome.json, packages/platform/atoms/package.json, packages/platform/atoms/tsconfig.json
Added linter restrictions for TRPC imports in atoms package, exposed new hook export path, removed TRPC React from TypeScript compilation scope.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Hooks hop along the path,
From atoms to the web so bright,
Platform springs and web's delight,
Separated yet in harmony—
Types align, imports confined,
A codebase clean and refined! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the pull request - removing the trpc/react dependency from @calcom/atoms. The changeset confirms this through refactored imports, moved hooks, updated biome rules, and modified tsconfig to exclude TRPC React code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx (1)

1-16: Remove the unused @calcom/trpc/react import.

This import violates the Biome restriction for the atoms package (blocking @calcom/trpc/react at line 13) and is not used anywhere in the file. The linter will fail until it's removed.

Proposed fix
-import { trpc } from "@calcom/trpc/react";
🤖 Fix all issues with AI agents
In `@apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx`:
- Around line 303-309: The rendered list is using teamMembers directly which
ignores the search/filter and assignAllTeamMembers logic computed into
filteredMembers; update the JSX to map over filteredMembers (rendering
<TeamMemberItem key={member.value} member={member}
onWeightChange={handleWeightChange} />) and change the empty-state check to use
filteredMembers.length === 0 so the search/filter and assign-all behavior are
respected.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d12009 and 1926c8e.

📒 Files selected for processing (7)
  • apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx
  • apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx
  • biome.json
  • packages/platform/atoms/availability/AvailabilitySettings.tsx
  • packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx
  • packages/platform/atoms/package.json
  • packages/platform/atoms/tsconfig.json
💤 Files with no reviewable changes (1)
  • packages/platform/atoms/tsconfig.json
🧰 Additional context used
🧬 Code graph analysis (1)
apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx (2)
packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx (2)
  • UseTeamMembersWithSegmentProps (18-25)
  • useProcessTeamMembersData (27-64)
packages/app-store/routing-forms/types/types.d.ts (1)
  • AttributesQueryValue (113-113)
🔇 Additional comments (10)
packages/platform/atoms/availability/AvailabilitySettings.tsx (4)

32-32: LGTM!

The type-only import of TravelScheduleRepository is appropriate for deriving the return type without introducing a runtime dependency.


198-198: LGTM!

The type change is consistent with the parent AvailabilitySettingsProps definition, maintaining type safety across the component hierarchy.


645-647: LGTM!

Formatting adjustment only, no functional change.


102-102: No action needed. The type change is safe—getTravelSchedulesHandler directly returns the repository method output without transformation, so Awaited<ReturnType<typeof TravelScheduleRepository.findTravelSchedulesByUserId>> and the previous RouterOutputs["viewer"]["travelSchedules"]["get"] are equivalent in shape.

biome.json (1)

326-358: Good restriction rule for atoms imports.

The new override cleanly blocks @calcom/trpc/react and relative trpc/react imports from the atoms package, matching the PR intent.

packages/platform/atoms/package.json (1)

75-75: Export map update looks correct.

The new public export for useTeamMembersWithSegmentPlatform aligns with the refactor.

packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx (1)

18-27: Exports look good.

Making the props interface and processing helper public aligns with the new platform/web split.

apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx (1)

1-37: Hook wiring looks solid.

The TRPC query and shared processing helper are integrated cleanly, and the returned shape aligns with the updated UI usage.

apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx (2)

28-32: Imports align with the new hook split.

No issues with the updated import sources.


128-134: Hook usage looks consistent.

The platform/web switch and destructured return shape match the new hook API.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines 303 to 309
<div className="flex max-h-[80dvh] flex-col overflow-y-auto rounded-md border">
{filteredMembers.map((member) => (
{teamMembers.map((member) => (
<TeamMemberItem key={member.value} member={member} onWeightChange={handleWeightChange} />
))}
{filteredMembers.length === 0 && (
{teamMembers.length === 0 && (
<div className="text-subtle py-4 text-center text-sm">{t("no_members_found")}</div>
)}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Search/filter no longer applied to the rendered list.

The UI now renders teamMembers directly, so search and assignAllTeamMembers filtering (computed in filteredMembers) is ignored, and the empty-state check is wrong. This regresses filtering behavior for users.

✅ Proposed fix
-              <div className="flex max-h-[80dvh] flex-col overflow-y-auto rounded-md border">
-                {teamMembers.map((member) => (
+              <div className="flex max-h-[80dvh] flex-col overflow-y-auto rounded-md border">
+                {filteredMembers.map((member) => (
                   <TeamMemberItem key={member.value} member={member} onWeightChange={handleWeightChange} />
                 ))}
-                {teamMembers.length === 0 && (
+                {filteredMembers.length === 0 && (
                   <div className="text-subtle py-4 text-center text-sm">{t("no_members_found")}</div>
                 )}
               </div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="flex max-h-[80dvh] flex-col overflow-y-auto rounded-md border">
{filteredMembers.map((member) => (
{teamMembers.map((member) => (
<TeamMemberItem key={member.value} member={member} onWeightChange={handleWeightChange} />
))}
{filteredMembers.length === 0 && (
{teamMembers.length === 0 && (
<div className="text-subtle py-4 text-center text-sm">{t("no_members_found")}</div>
)}
<div className="flex max-h-[80dvh] flex-col overflow-y-auto rounded-md border">
{filteredMembers.map((member) => (
<TeamMemberItem key={member.value} member={member} onWeightChange={handleWeightChange} />
))}
{filteredMembers.length === 0 && (
<div className="text-subtle py-4 text-center text-sm">{t("no_members_found")}</div>
)}
</div>
🤖 Prompt for AI Agents
In `@apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx`
around lines 303 - 309, The rendered list is using teamMembers directly which
ignores the search/filter and assignAllTeamMembers logic computed into
filteredMembers; update the JSX to map over filteredMembers (rendering
<TeamMemberItem key={member.value} member={member}
onWeightChange={handleWeightChange} />) and change the empty-state check to use
filteredMembers.length === 0 so the search/filter and assign-all behavior are
respected.

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