Skip to content

Code Review Bench PR #26694 - refactor: Remove trpc/react dependency from @calcom/atoms#12

Closed
ketkarameya wants to merge 8 commits intobase_pr_26694_20260125_7799from
corrupted_pr_26694_20260125_7799
Closed

Code Review Bench PR #26694 - refactor: Remove trpc/react dependency from @calcom/atoms#12
ketkarameya wants to merge 8 commits intobase_pr_26694_20260125_7799from
corrupted_pr_26694_20260125_7799

Conversation

@ketkarameya
Copy link

@ketkarameya ketkarameya commented Feb 10, 2026

Benchmark PR for Gitar evaluation

Original PR: agentic-review-benchmarks#12

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


Summary by Gitar

  • Hook refactoring:
    • Platform HTTP version in packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx uses @tanstack/react-query
    • Web tRPC version in apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx uses @calcom/trpc/react
  • Shared business logic:
    • useProcessTeamMembersData extracted to atoms package for code reuse across both implementations
  • Type modernization:
    • Replaced RouterOutputs["viewer"]["travelSchedules"]["get"] with Awaited<ReturnType<typeof TravelScheduleRepository.findTravelSchedulesByUserId>>
  • Architectural constraint:
    • Biome noRestrictedImports rule prevents future @calcom/trpc/react imports in atoms package
  • Impact:
    • Atoms package now independently distributable without Cal.com tRPC infrastructure

This will update automatically on new commits.


<div className="flex max-h-[80dvh] flex-col overflow-y-auto rounded-md border">
{filteredMembers.map((member) => (
{teamMembers.map((member) => (

Choose a reason for hiding this comment

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

⚠️ Bug: Search and filtering broken: filteredMembers computed but unused

The diff changes the rendering from filteredMembers.map(...) and filteredMembers.length === 0 to teamMembers.map(...) and teamMembers.length === 0 (lines 304 and 307). However, filteredMembers (line 231) is a useMemo that applies:

  1. Search filtering — filters by searchQuery against member label/email
  2. Weight assignment — adds weight property from localWeights
  3. assignAllTeamMembers filtering — filters based on the value array when assignAllTeamMembers is false

By rendering teamMembers directly instead of filteredMembers, the search input at line 294 no longer filters the displayed list, the weight values won't be displayed on members (missing .weight property), and the assignAllTeamMembers logic is bypassed. The filteredMembers variable becomes dead code.

Was this helpful? React with 👍 / 👎

Suggested change
{teamMembers.map((member) => (
{filteredMembers.map((member) => (
<TeamMemberItem key={member.value} member={member} onWeightChange={handleWeightChange} />
))}
{filteredMembers.length === 0 && (
  • Apply suggested fix

Copy link

@gitar-bot-staging gitar-bot-staging bot left a comment

Choose a reason for hiding this comment

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

⚠️ This PR is blocked due to unresolved code review findings.

Configure merge blocking · Maintainers can dismiss this review. Gitar never approves changes.

@gitar-bot-staging
Copy link

Code Review 🚫 Blocked 0 resolved / 3 findings

The PR's core goal of removing @calcom/trpc/react from atoms is undermined by a leftover trpc import that will fail the new Biome lint rule. Additionally, the rendering was switched from filteredMembers to teamMembers, breaking search filtering and the assignAllTeamMembers logic.

🚨 Bug: Leftover trpc import in atoms package violates PR goal

📄 packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx:13

The file useTeamMembersWithSegmentPlatform.tsx (in the atoms package) still imports trpc from @calcom/trpc/react on line 13. This directly contradicts the entire purpose of this PR — removing the tRPC dependency from the atoms package. The new Biome lint rule added in this same PR should flag this as an error, meaning the build/lint will fail.

This import was present in the original file and was not removed during the rename/refactor. The trpc symbol doesn't appear to be used anywhere in the platform hook (it uses @tanstack/react-query + HTTP instead), so it's just a leftover that needs to be deleted.

⚠️ Bug: Search and filtering broken: filteredMembers computed but unused

📄 apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx:304 📄 apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx:307

The diff changes the rendering from filteredMembers.map(...) and filteredMembers.length === 0 to teamMembers.map(...) and teamMembers.length === 0 (lines 304 and 307). However, filteredMembers (line 231) is a useMemo that applies:

  1. Search filtering — filters by searchQuery against member label/email
  2. Weight assignment — adds weight property from localWeights
  3. assignAllTeamMembers filtering — filters based on the value array when assignAllTeamMembers is false

By rendering teamMembers directly instead of filteredMembers, the search input at line 294 no longer filters the displayed list, the weight values won't be displayed on members (missing .weight property), and the assignAllTeamMembers logic is bypassed. The filteredMembers variable becomes dead code.

Suggested fix
                {filteredMembers.map((member) => (
                  <TeamMemberItem key={member.value} member={member} onWeightChange={handleWeightChange} />
                ))}
                {filteredMembers.length === 0 && (
💡 Quality: Unused useQuery import in web hook

📄 apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx:1

The new useTeamMembersWithSegment.tsx web hook imports useQuery from @tanstack/react-query on line 1, but it's never used — the hook uses trpc.viewer.attributes.findTeamMembersMatchingAttributeLogic.useQuery() instead (which is tRPC's wrapper, not the raw @tanstack/react-query hook). This unused import should be removed.

Suggested fix
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@kayagokalp
Copy link

Benchmark Evaluation Results

Ground Truth Bugs (Recall: 2/3 = 66.7%)

ID Severity Title Found?
GT-12-001 Critical Component renders teamMembers instead of filteredMembers, br Yes
GT-12-002 Important tRPC import remains in atoms package despite PR goal to remo Yes
GT-12-003 Important TravelScheduleRepository imported as type-only but used with No

Extra Gitar Findings

File Line Valid Bug? Notes
apps/web/modules/event-types/hooks/useTe 1 No Unused useQuery import in web hook

Summary

  • Recall: 66.7% (2/3)
  • Precision: 66.7% (2/3)
  • Precision counts ground truth matches + valid extra findings as true positives

@kayagokalp kayagokalp closed this Feb 25, 2026
@kayagokalp kayagokalp deleted the corrupted_pr_26694_20260125_7799 branch February 25, 2026 02:05
@kayagokalp kayagokalp restored the corrupted_pr_26694_20260125_7799 branch February 25, 2026 02:17
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.

4 participants