Skip to content

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 22, 2026

Benchmark PR from qodo-benchmark#708

Summary by CodeRabbit

  • Refactor
    • Reorganized internal component module structure and import paths across event types, bookings, and apps modules.
    • Consolidated component exports in package.json; removed legacy wrapper exports and added new hook exports for improved code organization.
    • Updated host sorting logic and moved utility functions to centralized locations for better code maintainability.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

This PR reorganizes and consolidates import paths for web components and utility functions across the codebase. Components previously exported from @calcom/atoms packages are being migrated to @calcom/web modules or local relative imports. Additionally, the sortHosts utility is extracted to a centralized location, and the atoms package exports are updated to reflect these structural changes.

Changes

Cohort / File(s) Summary
Booker Web Wrapper Consolidation
apps/web/modules/bookings/components/BookerWebWrapper.tsx, apps/web/modules/d/[link]/d-type-view.tsx, apps/web/modules/org/[orgSlug]/instant-meeting/team/[slug]/[type]/instant-meeting-view.tsx, apps/web/modules/team/type-view.tsx, apps/web/modules/team/type-view-cached.tsx, apps/web/modules/users/views/users-type-public-view.tsx
Import path for BookerWebWrapper updated from @calcom/atoms/booker to @calcom/web/modules/bookings/components/BookerWebWrapper; BookerWebWrapper now imports Booker locally from ./Booker instead of externally; removed useRouter hook usage
Event Type Wrapper Migration
apps/web/app/(use-page-wrapper)/event-types/[type]/page.tsx, apps/web/modules/event-types/components/EventTypeWebWrapper.tsx, apps/web/modules/event-types/components/AddMembersWithSwitch.tsx, apps/web/modules/event-types/components/AddMembersWithSwitchWebWrapper.tsx
EventTypeWebWrapper moved from @calcom/atoms/event-types/wrappers/ to @calcom/web/modules/event-types/components/; AddMembersWithSwitch imports updated to use relative paths; EventTypeWebWrapper refactored to use relative imports for tabs and local hooks
Event Type Tabs Web Wrapper Updates
apps/web/modules/event-types/components/tabs/*/EventSetupTabWebWrapper.tsx, */EventAvailabilityTabWebWrapper.tsx, */EventTeamAssignmentTabWebWrapper.tsx, */EventLimitsTabWebWrapper.tsx, */EventAdvancedWebWrapper.tsx, */EventRecurringWebWrapper.tsx
Tab-specific web wrappers updated to use relative imports instead of absolute module paths for corresponding tab components
Calendar Settings Wrapper Migration
apps/web/components/apps/CalendarListContainer.tsx, apps/web/components/apps/DestinationCalendarSettingsWebWrapper.tsx, apps/web/modules/calendars/components/SelectedCalendarsSettingsWebWrapper.tsx, apps/web/modules/event-types/components/tabs/advanced/EventAdvancedTab.tsx
DestinationCalendarSettingsWebWrapper moved to local relative path; SelectedCalendarsSettingsWebWrapper moved from @calcom/atoms/selected-calendars/wrappers/ to @calcom/web/modules/calendars/components/; imports updated to use absolute package paths where appropriate
Conferencing Apps Wrapper Migration
apps/web/app/(use-page-wrapper)/settings/(settings-layout)/my-account/conferencing/loading.tsx, apps/web/app/(use-page-wrapper)/settings/(settings-layout)/my-account/conferencing/page.tsx, apps/web/modules/apps/components/ConferencingAppsViewWebWrapper.tsx
ConferencingAppsViewWebWrapper moved from @calcom/atoms/connect/conferencing-apps/ to @calcom/web/modules/apps/components/; internal imports refactored to use relative paths
Utility Function Extraction
packages/lib/bookings/hostGroupUtils.ts, apps/web/modules/event-types/components/HostEditDialogs.tsx, apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTab.tsx, packages/platform/atoms/event-types/hooks/useEventTypeForm.ts
New sortHosts function added to hostGroupUtils.ts; references to sortHosts updated from HostEditDialogs to hostGroupUtils
Atoms Package Export Changes
packages/platform/atoms/booker/index.ts, packages/platform/atoms/package.json
Removed exports for BookerWebWrapper and BookerWebWrapperAtomProps from atoms booker index; updated atoms package.json exports map to remove web wrapper exports and add new hooks and calendar settings exports

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop along as imports dance anew,
From atoms to web, the paths break through,
Utilities bundled in bright new nests,
Organization puts code to the test,
With each module shuffled and sorted just so,
Our codebase blooms in architectural glow!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: moving WebWrapper files from packages/platform to apps/web/modules, which is the primary focus of this refactoring PR.

✏️ 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)
apps/web/modules/bookings/components/BookerWebWrapper.tsx (1)

183-196: router is undefined - this callback will fail at runtime.

The onOverlaySwitchStateChange callback references router which is no longer defined after the import removal. This will cause the overlay calendar toggle functionality to break.

🤖 Fix all issues with AI agents
In `@apps/web/modules/bookings/components/BookerWebWrapper.tsx`:
- Around line 4-5: The component still references router in functions like
onOverlaySwitchStateChange, and in places calling router.push (e.g., inside
BookerWebWrapperComponent and handlers that build newPath/newUrl), but useRouter
was removed from imports; re-import useRouter from next/navigation and
initialize const router = useRouter() inside BookerWebWrapperComponent
(alongside existing usePathname/useSearchParams) so all uses of router
(router.push calls and dependency arrays) are valid; ensure dependency arrays
that included [router] still reference the local router variable.
🧹 Nitpick comments (4)
apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx (1)

4-6: Consider whether this wrapper is necessary.

The wrapper component is a simple pass-through that adds no additional logic or behavior. If there's no plan to extend this wrapper with web-specific functionality, consider directly exporting EventLimitsTab instead.

♻️ Simplification option

If the wrapper serves no architectural purpose:

-import { EventLimitsTab } from "@calcom/web/modules/event-types/components/tabs/limits/EventLimitsTab";
-import type { EventLimitsTabProps } from "@calcom/web/modules/event-types/components/tabs/limits/EventLimitsTab";
-
-const EventLimitsTabWebWrapper = (props: EventLimitsTabProps) => {
-  return <EventLimitsTab {...props} />;
-};
-
-export default EventLimitsTabWebWrapper;
+export { EventLimitsTab as default } from "@calcom/web/modules/event-types/components/tabs/limits/EventLimitsTab";
packages/lib/bookings/hostGroupUtils.ts (1)

41-60: LGTM — consider adding a brief JSDoc comment.

The centralized sortHosts utility handles null defaults appropriately and correctly implements dual-mode sorting. The sorting logic differs intentionally between weight-enabled and weight-disabled modes (ascending vs descending priority). A short JSDoc explaining the expected sort order for each mode would help future maintainers.

📝 Optional: Add documentation for sort behavior
+/**
+ * Sorts hosts for round-robin assignment.
+ * - When RR weights enabled: higher weight first, then lower priority value first (ties).
+ * - When RR weights disabled: higher priority value first.
+ */
 export function sortHosts(
   hostA: { priority: number | null; weight: number | null },
   hostB: { priority: number | null; weight: number | null },
   isRRWeightsEnabled: boolean
 ) {
apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTab.tsx (1)

8-8: Potential circular import between sibling modules.

This creates a circular dependency:

  • EventAvailabilityTabWebWrapper imports EventAvailabilityTab
  • EventAvailabilityTab imports GetAllSchedulesByUserIdQueryType from EventAvailabilityTabWebWrapper

While this may work for type-only imports with TypeScript's isolatedModules, it can cause issues with certain bundlers or at runtime. Consider extracting shared types to a dedicated types.ts file in this directory.

♻️ Suggested refactor: Extract shared types

Create apps/web/modules/event-types/components/tabs/availability/types.ts:

import type { trpc } from "@calcom/trpc/react";

export type GetAllSchedulesByUserIdQueryType =
  typeof trpc.viewer.availability.schedule.getAllSchedulesByUserId.useQuery;

Then update both files to import from ./types:

-import type { GetAllSchedulesByUserIdQueryType } from "./EventAvailabilityTabWebWrapper";
+import type { GetAllSchedulesByUserIdQueryType } from "./types";
apps/web/modules/event-types/components/EventTypeWebWrapper.tsx (1)

24-31: Import ordering could be improved for consistency.

The imports mix package paths (@calcom/web, @calcom/atoms) with relative paths. Consider grouping them consistently:

  1. External packages (next/..., zod)
  2. Internal packages (@calcom/...)
  3. Relative imports (./...)
♻️ Suggested reordering
-import { revalidateTeamEventTypeCache } from "@calcom/web/app/(booking-page-wrapper)/team/[slug]/[type]/actions";
-import { revalidateEventTypeEditPage } from "@calcom/web/app/(use-page-wrapper)/event-types/[type]/actions";
-
-import type { ChildrenEventType } from "./ChildrenEventTypeSelect";
-import { EventType as EventTypeComponent } from "./EventType";
 import { useEventTypeForm } from "@calcom/atoms/event-types/hooks/useEventTypeForm";
 import { useHandleRouteChange } from "@calcom/atoms/event-types/hooks/useHandleRouteChange";
 import { useTabsNavigations } from "@calcom/atoms/event-types/hooks/useTabsNavigations";
+import { revalidateTeamEventTypeCache } from "@calcom/web/app/(booking-page-wrapper)/team/[slug]/[type]/actions";
+import { revalidateEventTypeEditPage } from "@calcom/web/app/(use-page-wrapper)/event-types/[type]/actions";
+
+import type { ChildrenEventType } from "./ChildrenEventTypeSelect";
+import { EventType as EventTypeComponent } from "./EventType";
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f8dec3 and 44582ee.

📒 Files selected for processing (30)
  • apps/web/app/(use-page-wrapper)/event-types/[type]/page.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/my-account/conferencing/loading.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/my-account/conferencing/page.tsx
  • apps/web/components/apps/CalendarListContainer.tsx
  • apps/web/components/apps/DestinationCalendarSettingsWebWrapper.tsx
  • apps/web/modules/apps/components/ConferencingAppsViewWebWrapper.tsx
  • apps/web/modules/bookings/components/BookerWebWrapper.tsx
  • apps/web/modules/calendars/components/SelectedCalendarsSettingsWebWrapper.tsx
  • apps/web/modules/d/[link]/d-type-view.tsx
  • apps/web/modules/event-types/components/AddMembersWithSwitch.tsx
  • apps/web/modules/event-types/components/AddMembersWithSwitchWebWrapper.tsx
  • apps/web/modules/event-types/components/EventTypeWebWrapper.tsx
  • apps/web/modules/event-types/components/HostEditDialogs.tsx
  • apps/web/modules/event-types/components/tabs/advanced/EventAdvancedTab.tsx
  • apps/web/modules/event-types/components/tabs/advanced/EventAdvancedWebWrapper.tsx
  • apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTab.tsx
  • apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTabWebWrapper.tsx
  • apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTab.tsx
  • apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTabWebWrapper.tsx
  • apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx
  • apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx
  • apps/web/modules/event-types/components/tabs/setup/EventSetupTabWebWrapper.tsx
  • apps/web/modules/org/[orgSlug]/instant-meeting/team/[slug]/[type]/instant-meeting-view.tsx
  • apps/web/modules/team/type-view-cached.tsx
  • apps/web/modules/team/type-view.tsx
  • apps/web/modules/users/views/users-type-public-view.tsx
  • packages/lib/bookings/hostGroupUtils.ts
  • packages/platform/atoms/booker/index.ts
  • packages/platform/atoms/event-types/hooks/useEventTypeForm.ts
  • packages/platform/atoms/package.json
💤 Files with no reviewable changes (1)
  • packages/platform/atoms/booker/index.ts
🔇 Additional comments (27)
apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx (1)

4-8: LGTM — no functional change here.

Wrapper remains a simple passthrough; nothing to adjust.

apps/web/modules/apps/components/ConferencingAppsViewWebWrapper.tsx (1)

14-15: LGTM — local imports align with refactor.

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/my-account/conferencing/loading.tsx (1)

1-1: LGTM — import path matches new module location.

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/my-account/conferencing/page.tsx (1)

4-4: LGTM — import path matches new module location.

apps/web/modules/event-types/components/AddMembersWithSwitch.tsx (1)

6-7: LGTM - Import path refactoring is correct.

The relative import aligns with the new local file structure. Note there's a circular dependency between this file and AddMembersWithSwitchWebWrapper.tsx (each imports from the other). This pattern is common for wrapper/base component relationships and works fine with ES modules since the component references aren't evaluated until render time.

apps/web/modules/event-types/components/AddMembersWithSwitchWebWrapper.tsx (1)

3-5: LGTM - Local imports are correctly configured.

Using import type for AddMembersWithSwitchProps is good practice as it ensures the type import is erased at compile time, which helps mitigate potential circular dependency issues at runtime.

packages/platform/atoms/event-types/hooks/useEventTypeForm.ts (1)

11-11: LGTM!

The import path correctly points to the centralized sortHosts utility in hostGroupUtils.

apps/web/modules/event-types/components/tabs/setup/EventSetupTabWebWrapper.tsx (1)

6-8: LGTM!

Relative imports are appropriate for co-located files within the same tabs/setup/ directory.

apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTabWebWrapper.tsx (1)

8-10: LGTM!

Import paths correctly updated to use relative paths within the consolidated module structure.

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

48-91: LGTM!

Dynamic imports correctly updated to reference the consolidated tab wrapper locations under ./tabs/.


234-250: LGTM!

Tab rendering is unchanged functionally; formatting adjustments are consistent.

apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTabWebWrapper.tsx (1)

1-4: Relative import is appropriate for co-located modules.

Using a relative import (./EventTeamAssignmentTab) for files in the same directory is cleaner than the external alias path and reduces dependency on module alias configuration.

apps/web/app/(use-page-wrapper)/event-types/[type]/page.tsx (1)

9-9: Import path update correctly reflects component migration.

The import path change to @calcom/web/modules/event-types/components/EventTypeWebWrapper is valid. The component exists at the new location and the old path is no longer in the codebase.

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

59-75: Package exports updated to reflect WebWrapper migration.

The export changes correctly remove WebWrapper references that have been migrated to @calcom/web/modules, while adding new exports for the event-types hooks (useEventTypeForm, useHandleRouteChange, useTabsNavigations) and the SelectedCalendarsSettings component. No orphaned imports of removed WebWrapper exports exist in the codebase.

apps/web/modules/event-types/components/HostEditDialogs.tsx (1)

13-13: Host utilities properly consolidated into shared module.

The import of groupHostsByGroupId, getHostsFromOtherGroups, and sortHosts from @calcom/lib/bookings/hostGroupUtils is correct. All three functions are properly exported from the utility file. This consolidation improves maintainability by centralizing host-related logic in a single source of truth.

apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTab.tsx (1)

17-17: Import centralized to shared utility location.

Moving sortHosts to @calcom/lib/bookings/hostGroupUtils centralizes the host-related utility for reuse across the codebase. The function is properly exported and used consistently at lines 324 and 332.

apps/web/modules/calendars/components/SelectedCalendarsSettingsWebWrapper.tsx (1)

15-15: LGTM!

The import path update to @calcom/atoms/selected-calendars/SelectedCalendarsSettings aligns with the broader module reorganization in this PR.

apps/web/modules/event-types/components/tabs/advanced/EventAdvancedTab.tsx (1)

9-13: LGTM!

The import path update to @calcom/web/modules/calendars/components/SelectedCalendarsSettingsWebWrapper is consistent with the module reorganization pattern used across this PR.

apps/web/modules/event-types/components/tabs/advanced/EventAdvancedWebWrapper.tsx (1)

3-5: LGTM!

Using relative imports (./EventAdvancedTab) for co-located components is appropriate and aligns with the local module structure approach in this PR.

apps/web/components/apps/CalendarListContainer.tsx (1)

6-7: LGTM!

The import path updates are appropriate:

  • Relative import for co-located DestinationCalendarSettingsWebWrapper
  • Package-scoped import for SelectedCalendarsSettingsWebWrapper from the web modules namespace
apps/web/modules/bookings/components/BookerWebWrapper.tsx (1)

35-36: LGTM for the Booker import change.

The import path update to a local ./Booker component is consistent with the PR's module reorganization objectives.

apps/web/components/apps/DestinationCalendarSettingsWebWrapper.tsx (1)

3-4: Use the public API exports from @calcom/atoms instead of deep relative paths.

The deep relative paths here traverse directly into the package structure, which is fragile. However, note that the suggested imports in the original review would not work—these paths are not exported from @calcom/atoms.

The file should import from the public API:

  • DestinationCalendarSettings is properly exported from @calcom/atoms
  • AtomsWrapper is not part of the public API and should be either added to the public exports or its usage reconsidered

Verify the correct import path for AtomsWrapper (it may be an internal component) and update both imports to use the package alias:

-import { AtomsWrapper } from "../../../../packages/platform/atoms/src/components/atoms-wrapper";
-import { DestinationCalendarSettings } from "../../../../packages/platform/atoms/destination-calendar/DestinationCalendar";
+import { DestinationCalendarSettings } from "@calcom/atoms";

For AtomsWrapper, confirm whether it should be part of the public API or if there's an alternative approach.

Likely an incorrect or invalid review comment.

apps/web/modules/org/[orgSlug]/instant-meeting/team/[slug]/[type]/instant-meeting-view.tsx (1)

5-5: LGTM — import path refactor only.

No behavioral changes; usage remains consistent.

apps/web/modules/users/views/users-type-public-view.tsx (1)

6-6: LGTM — import path refactor only.

No behavioral or prop changes observed.

apps/web/modules/d/[link]/d-type-view.tsx (1)

3-3: LGTM — import path refactor only.

No runtime changes expected.

apps/web/modules/team/type-view.tsx (1)

6-6: LGTM — import path refactor only.

No logic changes in this segment.

apps/web/modules/team/type-view-cached.tsx (1)

3-3: LGTM — type import path refactor only.

No behavior or API changes in this file.

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

Comment on lines +4 to +5
import { useSearchParams, usePathname } from "next/navigation";
import { useMemo, useCallback, useEffect } from "react";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: useRouter was removed but router is still used throughout the component.

The import for useRouter from next/navigation was removed, but the router variable is still used in multiple places:

  • Line 193: router.push(...) in onOverlaySwitchStateChange
  • Line 195: [router] in dependency array
  • Line 228: router.push(newPath)
  • Line 232: router.push("/apps/categories/calendar")
  • Line 238: router.push(newUrl.toString())

This will cause runtime errors (ReferenceError: router is not defined) when users interact with the overlay calendar, instant meeting, or navigation features.

Proposed fix: Restore the useRouter import and usage
-import { useSearchParams, usePathname } from "next/navigation";
-import { useMemo, useCallback, useEffect } from "react";
+import { useSearchParams, usePathname, useRouter } from "next/navigation";
+import { useMemo, useCallback, useEffect } from "react";

Then add the router initialization inside BookerWebWrapperComponent:

const BookerWebWrapperComponent = (props: BookerWebWrapperAtomProps) => {
  const pathname = usePathname();
  const searchParams = useSearchParams();
  const router = useRouter(); // Add this line
  // ... rest of component
🤖 Prompt for AI Agents
In `@apps/web/modules/bookings/components/BookerWebWrapper.tsx` around lines 4 -
5, The component still references router in functions like
onOverlaySwitchStateChange, and in places calling router.push (e.g., inside
BookerWebWrapperComponent and handlers that build newPath/newUrl), but useRouter
was removed from imports; re-import useRouter from next/navigation and
initialize const router = useRouter() inside BookerWebWrapperComponent
(alongside existing usePathname/useSearchParams) so all uses of router
(router.push calls and dependency arrays) are valid; ensure dependency arrays
that included [router] still reference the local router variable.

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