refactor: move shared components from apps/web to packages/features#27490
refactor: move shared components from apps/web to packages/features#27490
Conversation
Move components that don't require dependency injection: - DisconnectIntegrationModal - Booking components (Header, Section, TimeFormatToggle, PayIcon, Price) - useInitializeWeekStart hook - TeamEventTypeForm - Event type components (AssignAllTeamMembers, BulkEditDefaultForEventsModal, etc.) - Event type dialogs (HostEditDialogs, ManagedEventDialog) - Location components (LocationInput, types) - Tab components (EventLimitsTab, EventRecurringTab, etc.) Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
Update imports in apps/web and packages/platform/atoms to reference the moved components from @calcom/features instead of @calcom/web. Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Complete the file move by deleting the original files that were copied to packages/features. This makes it a proper move instead of a copy, reducing the PR size significantly. Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
Update import paths in apps/web files that reference components that were moved from apps/web/modules to packages/features: - LearnMoreLink - ChildrenEventTypeSelect - AssignAllTeamMembers - WeightDescription - LocationCustomClassNames (types) Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
Update import paths in apps/web files that reference components moved from apps/web/modules to packages/features: - AppList.tsx: BulkEditDefaultForEventsModal - schedule-view.tsx: BulkUpdatParams type - AddMembersWithSwitch.tsx: AssignAllTeamMembers, CheckedTeamSelect - EventTypeWebWrapper.tsx: ChildrenEventType, ManagedEventDialog - DefaultLocationSettings.tsx: LocationCustomClassNames, LocationInput - Locations.tsx: LocationCustomClassNames, LocationInput Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
There was a problem hiding this comment.
1 issue found across 55 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/platform/atoms/calendar-view/CalendarViewComponent.tsx">
<violation number="1" location="packages/platform/atoms/calendar-view/CalendarViewComponent.tsx:1">
P1: These imports introduce a circular dependency: @calcom/atoms (CalendarViewComponent) now depends on @calcom/features/Header, but Header depends on @calcom/atoms (useIsPlatform). Atoms should not depend on Features if Features already depend on Atoms—this can break bundling/runtime.
Consider moving useIsPlatform to a lower-level shared package (e.g., @calcom/lib), or refactoring Header to accept an `isPlatform` prop so it no longer imports from @calcom/atoms.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
This fixes the circular dependency where @calcom/atoms (CalendarViewComponent)
was importing Header from @calcom/features, but Header was importing
useIsPlatform from @calcom/atoms.
The fix adds an isPlatform prop to the Header component so it no longer
needs to import useIsPlatform from @calcom/atoms. Callers now pass the
isPlatform value directly:
- atoms components pass isPlatform={true}
- web components pass the isPlatform prop they receive
Fix confidence: 9/10 (Cubic AI)
Co-Authored-By: unknown <>
E2E results are ready! |
|
Hi @hbjORbj, great work on this! |
|
We don't really prefer barrel files @deepeshbind |
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/features/bookings/components/Header.tsx">
<violation number="1" location="packages/features/bookings/components/Header.tsx:189">
P1: `LayoutToggle` now calls `useIsPlatform`, reintroducing a dependency from features to atoms and causing a circular dependency because atoms import `Header`. Consider keeping the `isPlatform` prop thread instead of using the hook here to avoid cycles.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
| @@ -187,7 +187,6 @@ const LayoutToggle = ({ | |||
| }) => { | |||
| const isEmbed = useIsEmbed(); | |||
| const isPlatform = useIsPlatform(); | |||
There was a problem hiding this comment.
so, now features is importing atoms for this hook. I am aware that this isn't ideal, but there are already many other cases where features import atoms. It's another decoupling we should do. I will handle it in separate PRs.
What does this PR do?
This PR moves shared components from
apps/web/modulestopackages/featuresto reduce circular dependencies wherepackages/platform/atomswas importing from@calcom/web. This is Part 1 of 2 - containing only pure file moves without any dependency injection pattern changes.Context: This is a split from PR #26995 to reduce risk. Part 1 (this PR) contains safe, straightforward file moves. Part 2 will contain the dependency injection pattern changes for components that have tRPC dependencies.
Components moved to packages/features:
DisconnectIntegrationModal→@calcom/features/apps/componentsHeader,Section,TimeFormatToggle,PayIcon,Price) →@calcom/features/bookings/componentsuseInitializeWeekStarthook →@calcom/features/bookings/hooksTeamEventTypeForm→@calcom/features/ee/teams/componentsAssignAllTeamMembers,BulkEditDefaultForEventsModal,CheckedTeamSelect,ChildrenEventTypeSelect,CreateEventTypeForm,LearnMoreLink,WeightDescription) →@calcom/features/eventtypes/componentsHostEditDialogs,ManagedEventDialog) →@calcom/features/eventtypes/components/dialogsLocationInput,types) →@calcom/features/eventtypes/components/locationsEventLimitsTab,EventRecurringTab, etc.) →@calcom/features/eventtypes/components/tabsUpdates since last revision:
Fixed circular dependency in Header component (addresses Cubic AI review feedback with 9/10 confidence):
The
Headercomponent (now in@calcom/features/bookings/components) was importinguseIsPlatformfrom@calcom/atoms, creating a circular dependency:@calcom/atoms→@calcom/features(imports Header) →@calcom/atoms(imports useIsPlatform)Fix: Refactored
Headerto accept anisPlatformprop instead of callinguseIsPlatforminternally:isPlatform?: booleanprop toHeader,LayoutToggle, andLayoutToggleWithData(defaults tofalse)CalendarViewComponent.tsx:isPlatform={true}EventTypeCalendarViewComponent.tsx:isPlatform={true}Booker.tsx:isPlatform={isPlatform}Verification:
@calcom/trpcimports@calcom/webimports