refactor: Remove trpc/react dependency from @calcom/atoms#39
Conversation
WalkthroughThis PR reorganizes team member segment hooks by relocating Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
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/reactimport.This import violates the Biome restriction for the atoms package (blocking
@calcom/trpc/reactat 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
📒 Files selected for processing (7)
apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsxapps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsxbiome.jsonpackages/platform/atoms/availability/AvailabilitySettings.tsxpackages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsxpackages/platform/atoms/package.jsonpackages/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
TravelScheduleRepositoryis appropriate for deriving the return type without introducing a runtime dependency.
198-198: LGTM!The type change is consistent with the parent
AvailabilitySettingsPropsdefinition, 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—getTravelSchedulesHandlerdirectly returns the repository method output without transformation, soAwaited<ReturnType<typeof TravelScheduleRepository.findTravelSchedulesByUserId>>and the previousRouterOutputs["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/reactand relativetrpc/reactimports 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
useTeamMembersWithSegmentPlatformaligns 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.
| <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> | ||
| )} |
There was a problem hiding this comment.
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.
| <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.
Benchmark PR from agentic-review-benchmarks#12
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.