-
Notifications
You must be signed in to change notification settings - Fork 12
Async import of the appStore packages #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: appstore-sync-refactor-base
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding try-catch around the await to handle import failures gracefully
|
This PR is being marked as stale due to inactivity. |
Test 2