Async import of the appStore packages#2
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR implements a significant architectural change to make all app store package imports asynchronous across the Cal.com codebase. The core change is in packages/app-store/index.ts, which converts all static imports to dynamic imports using import() statements for calendar integrations, video providers, payment processors, and other app store packages.
This refactoring touches multiple critical components:
- Calendar Management:
CalendarManager.ts,EventManager.ts, andgetCalendar.tsnow handle async calendar loading - Video Services:
videoClient.tsconverts from synchronous to async video adapter loading - Payment Processing: Payment-related files like
handlePayment.tsanddeletePayment.tsnow await app store access - Booking Operations: Core booking flows in
handleNewBooking.ts,handleCancelBooking.ts, and reschedule operations now handle async calendar operations
The change enables lazy loading of integrations, potentially reducing initial bundle size and improving startup performance by loading only the integrations actually needed at runtime. This is particularly beneficial for Cal.com given its extensive integration ecosystem.
PR Description Notes:
- The PR body only contains "Test 2" which lacks any meaningful description of the changes
Confidence score: 2/5
- This PR has critical implementation flaws that will cause production issues, particularly with async
forEachloops that won't properly wait for operations to complete - Multiple files use
forEachwith async callbacks which creates race conditions and potential data loss during booking operations - Files with critical issues:
packages/app-store/wipemycalother/lib/reschedule.ts,packages/app-store/vital/lib/reschedule.ts,packages/trpc/server/routers/viewer/bookings.tsx - The core architectural change is sound but the implementation has serious async handling problems
12 files reviewed, no comments
| calendarType = calendarType.split("_other_calendar")[0]; | ||
| } | ||
| const calendarApp = appStore[calendarType.split("_").join("") as keyof typeof appStore]; | ||
| const calendarApp = await appStore[calendarType.split("_").join("") as keyof typeof appStore]; |
There was a problem hiding this comment.
style: Consider adding try-catch around the await to handle import failures gracefully
| calendarType = calendarType.split("_other_calendar")[0]; | ||
| } | ||
| const calendarApp = appStore[calendarType.split("_").join("") as keyof typeof appStore]; | ||
| const calendarApp = await appStore[calendarType.split("_").join("") as keyof typeof appStore]; |
There was a problem hiding this comment.
style: Consider adding try-catch around the await to handle import failures gracefully
|
This PR is being marked as stale due to inactivity. |
Review Summary🏷️ Draft Comments (15)
🔍 Comments beyond diff scope (2)
|
Test 2