Skip to content

Async import of the appStore packages#10

Open
ShashankFC wants to merge 1 commit into
appstore-sync-refactor-basefrom
appstore-async-improvements
Open

Async import of the appStore packages#10
ShashankFC wants to merge 1 commit into
appstore-sync-refactor-basefrom
appstore-async-improvements

Conversation

@ShashankFC

Copy link
Copy Markdown

Test 2nn

Summary by CodeRabbit

Release Notes

  • Refactor
    • Improved reliability of calendar event operations during booking creation, updates, and cancellations.
    • Enhanced video meeting provisioning for better performance and stability.
    • Streamlined payment processing to ensure proper app loading before transactions.

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

nn---n*Replicated from [ai-code-review-evaluation/cal.com-coderabbit#2](https://github.com/ai-code-review-evaluation/cal.com-coderabbit/pull/2)*

@ShashankFC ShashankFC requested a review from Copilot January 30, 2026 10:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the app store imports to use dynamic imports instead of static imports, enabling asynchronous loading of app packages. The changes propagate async/await patterns throughout the codebase where calendar, video, and payment app functionality is accessed.

Changes:

  • Converted app store from static imports to dynamic imports using import() statements
  • Updated all consumers of getCalendar, getVideoAdapters, and app store access to use async/await
  • Refactored forEach loops to for...of loops where async operations are performed inside the iteration

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/app-store/index.ts Replaced static imports with dynamic import() calls for all app modules
packages/app-store/_utils/getCalendar.ts Made getCalendar function async to await app store module loading
packages/core/CalendarManager.ts Updated calendar operations to await async getCalendar calls
packages/core/EventManager.ts Added await to getCalendar call in event deletion
packages/core/videoClient.ts Refactored video adapter functions to be async and use for...of loops
packages/trpc/server/routers/viewer/bookings.tsx Added async/await to calendar and payment operations
packages/features/bookings/lib/handleNewBooking.ts Updated calendar deletion to await async getCalendar
packages/features/bookings/lib/handleCancelBooking.ts Converted forEach to for...of loop and added async/await for calendar operations
packages/lib/payment/handlePayment.ts Added await to app store payment app access
packages/lib/payment/deletePayment.ts Added await to app store payment app access
packages/app-store/wipemycalother/lib/reschedule.ts Made forEach callback async for calendar deletion
packages/app-store/vital/lib/reschedule.ts Made forEach callback async for calendar deletion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +553 to 559
bookingRefsFiltered.forEach(async (bookingRef) => {
if (bookingRef.uid) {
if (bookingRef.type.endsWith("_calendar")) {
const calendar = getCalendar(credentialsMap.get(bookingRef.type));
const calendar = await getCalendar(credentialsMap.get(bookingRef.type));

return calendar?.deleteEvent(
bookingRef.uid,

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

Using an async callback within forEach creates a fire-and-forget scenario where the promises are not awaited. The deletion operations will not block execution and errors may go unhandled. Convert this to a for...of loop or use Promise.all with map to properly await all deletion operations.

Copilot uses AI. Check for mistakes.
Comment on lines +125 to 131
bookingRefsFiltered.forEach(async (bookingRef) => {
if (bookingRef.uid) {
if (bookingRef.type.endsWith("_calendar")) {
const calendar = getCalendar(credentialsMap.get(bookingRef.type));
const calendar = await getCalendar(credentialsMap.get(bookingRef.type));
return calendar?.deleteEvent(bookingRef.uid, builder.calendarEvent);
} else if (bookingRef.type.endsWith("_video")) {
return deleteMeeting(credentialsMap.get(bookingRef.type), bookingRef.uid);

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

Using an async callback within forEach creates a fire-and-forget scenario where the promises are not awaited. The deletion operations will not block execution and errors may go unhandled. Convert this to a for...of loop or use Promise.all with map to properly await all deletion operations.

Copilot uses AI. Check for mistakes.
Comment on lines +125 to 131
bookingRefsFiltered.forEach(async (bookingRef) => {
if (bookingRef.uid) {
if (bookingRef.type.endsWith("_calendar")) {
const calendar = getCalendar(credentialsMap.get(bookingRef.type));
const calendar = await getCalendar(credentialsMap.get(bookingRef.type));
return calendar?.deleteEvent(bookingRef.uid, builder.calendarEvent);
} else if (bookingRef.type.endsWith("_video")) {
return deleteMeeting(credentialsMap.get(bookingRef.type), bookingRef.uid);

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

Using an async callback within forEach creates a fire-and-forget scenario where the promises are not awaited. The deletion operations will not block execution and errors may go unhandled. Convert this to a for...of loop or use Promise.all with map to properly await all deletion operations.

Copilot uses AI. Check for mistakes.
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.

3 participants