refactor: Remove trpc/react dependency from @calcom/atoms#91
Conversation
Greptile SummaryRefactors the
Critical Issue: The platform hook still imports Potential Issue: The change from Confidence Score: 1/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Web as Web App
participant WebHook as useTeamMembersWithSegment (Web)
participant TRPC as tRPC Client
participant Platform as Platform Atoms
participant PlatformHook as useTeamMembersWithSegmentPlatform
participant HTTP as HTTP Client
participant SharedLogic as useProcessTeamMembersData
Note over Web,SharedLogic: Platform Context (isPlatform=true)
Web->>PlatformHook: useTeamMembersWithSegmentPlatform()
PlatformHook->>HTTP: GET /atoms/organizations/{orgId}/teams/{teamId}/members-matching-attribute
HTTP-->>PlatformHook: matchingTeamMembersWithResult
PlatformHook->>SharedLogic: useProcessTeamMembersData()
SharedLogic-->>PlatformHook: { teamMembers, localWeightsInitialValues, isPending }
PlatformHook-->>Web: Return processed data
Note over Web,SharedLogic: Web Context (isPlatform=false)
Web->>WebHook: useTeamMembersWithSegment()
WebHook->>TRPC: trpc.viewer.attributes.findTeamMembersMatchingAttributeLogic.useQuery()
TRPC-->>WebHook: matchingTeamMembersWithResult
WebHook->>SharedLogic: useProcessTeamMembersData()
SharedLogic-->>WebHook: { teamMembers, localWeightsInitialValues, isPending }
WebHook-->>Web: Return processed data
|
There was a problem hiding this comment.
Additional Comments (2)
-
packages/platform/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform.tsx, line 13 (link)logic: violates the new biome lint rule that prohibits importing
@calcom/trpc/reactin the atoms package -
apps/web/modules/event-types/components/EditWeightsForAllTeamMembers.tsx, line 231-249 (link)style:
filteredMembersis computed but never used since the code now usesteamMembersdirectly
7 files reviewed, 3 comments
| const { teamMembers, localWeightsInitialValues } = useProcessTeamMembersData({ | ||
| initialTeamMembers, | ||
| assignRRMembersUsingSegment, | ||
| matchingTeamMembersWithResult: matchingTeamMembersWithResult?.result ? { result: matchingTeamMembersWithResult.result } : matchingTeamMembersWithResult, |
There was a problem hiding this comment.
style: verify the structure of matchingTeamMembersWithResult - the conditional wrapping suggests the trpc query might already return the result field directly, making the wrap redundant. does the trpc query return the result directly or wrapped in a result field?
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx
Line: 28:28
Comment:
**style:** verify the structure of `matchingTeamMembersWithResult` - the conditional wrapping suggests the trpc query might already return the result field directly, making the wrap redundant. does the trpc query return the result directly or wrapped in a result field?
How can I resolve this? If you propose a fix, please make it concise.
Benchmark PR from qodo-benchmark#722