-
Notifications
You must be signed in to change notification settings - Fork 12k
feat: implement lazy loading for app store to improve dev performance #23311
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
Closed
vishwamartur
wants to merge
12
commits into
calcom:main
from
vishwamartur:feat/app-store-lazy-loading
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e90bfcb
feat: implement lazy loading for app store to improve dev performance
vishwamartur 446d89d
fix: correct typo and improve documentation accuracy
vishwamartur ef2e815
fix: correct remaining typos in insights config.json
vishwamartur f94d5d1
fix: improve compatibility proxy to return undefined for unknown keys
vishwamartur ec5c0ed
feat: optimize insights analytics script loading and security
vishwamartur 2cb7cce
Merge branch 'main' into feat/app-store-lazy-loading
vishwamartur 07ff55c
Merge branch 'main' into feat/app-store-lazy-loading
vishwamartur 8e572a2
fix: address PR feedback and improve configuration
vishwamartur 09d76eb
fix: improve test spy to use actual module namespace
vishwamartur 6c9cb48
Merge branch 'main' into feat/app-store-lazy-loading
vishwamartur d19fcaf
fix: resolve TypeScript errors in payment app lazy loading
vishwamartur ad9c17c
Merge branch 'main' into feat/app-store-lazy-loading
vishwamartur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,67 +1,21 @@ | ||
| const appStore = { | ||
| alby: createCachedImport(() => import("./alby")), | ||
| applecalendar: createCachedImport(() => import("./applecalendar")), | ||
| caldavcalendar: createCachedImport(() => import("./caldavcalendar")), | ||
| closecom: createCachedImport(() => import("./closecom")), | ||
| dailyvideo: createCachedImport(() => import("./dailyvideo")), | ||
| dub: createCachedImport(() => import("./dub")), | ||
| googlecalendar: createCachedImport(() => import("./googlecalendar")), | ||
| googlevideo: createCachedImport(() => import("./googlevideo")), | ||
| hubspot: createCachedImport(() => import("./hubspot")), | ||
| huddle01video: createCachedImport(() => import("./huddle01video")), | ||
| "ics-feedcalendar": createCachedImport(() => import("./ics-feedcalendar")), | ||
| jellyconferencing: createCachedImport(() => import("./jelly")), | ||
| jitsivideo: createCachedImport(() => import("./jitsivideo")), | ||
| larkcalendar: createCachedImport(() => import("./larkcalendar")), | ||
| nextcloudtalkvideo: createCachedImport(() => import("./nextcloudtalk")), | ||
| office365calendar: createCachedImport(() => import("./office365calendar")), | ||
| office365video: createCachedImport(() => import("./office365video")), | ||
| plausible: createCachedImport(() => import("./plausible")), | ||
| paypal: createCachedImport(() => import("./paypal")), | ||
| "pipedrive-crm": createCachedImport(() => import("./pipedrive-crm")), | ||
| salesforce: createCachedImport(() => import("./salesforce")), | ||
| zohocrm: createCachedImport(() => import("./zohocrm")), | ||
| sendgrid: createCachedImport(() => import("./sendgrid")), | ||
| stripepayment: createCachedImport(() => import("./stripepayment")), | ||
| tandemvideo: createCachedImport(() => import("./tandemvideo")), | ||
| vital: createCachedImport(() => import("./vital")), | ||
| zoomvideo: createCachedImport(() => import("./zoomvideo")), | ||
| wipemycalother: createCachedImport(() => import("./wipemycalother")), | ||
| webexvideo: createCachedImport(() => import("./webex")), | ||
| giphy: createCachedImport(() => import("./giphy")), | ||
| zapier: createCachedImport(() => import("./zapier")), | ||
| make: createCachedImport(() => import("./make")), | ||
| exchange2013calendar: createCachedImport(() => import("./exchange2013calendar")), | ||
| exchange2016calendar: createCachedImport(() => import("./exchange2016calendar")), | ||
| exchangecalendar: createCachedImport(() => import("./exchangecalendar")), | ||
| facetime: createCachedImport(() => import("./facetime")), | ||
| sylapsvideo: createCachedImport(() => import("./sylapsvideo")), | ||
| zohocalendar: createCachedImport(() => import("./zohocalendar")), | ||
| "zoho-bigin": createCachedImport(() => import("./zoho-bigin")), | ||
| basecamp3: createCachedImport(() => import("./basecamp3")), | ||
| telegramvideo: createCachedImport(() => import("./telegram")), | ||
| shimmervideo: createCachedImport(() => import("./shimmervideo")), | ||
| hitpay: createCachedImport(() => import("./hitpay")), | ||
| btcpayserver: createCachedImport(() => import("./btcpayserver")), | ||
| }; | ||
| /** | ||
| * Cal.com App Store - Optimized for Performance | ||
| * | ||
| * This module provides lazy loading for Cal.com apps to improve development | ||
| * performance. Instead of loading all 100+ apps upfront, apps are loaded | ||
| * on-demand when actually needed. | ||
| * | ||
| * IMPLEMENTATION CHANGE: This replaces the previous monolithic app store with | ||
| * a lazy loading system that reduces initial bundle size significantly. | ||
| * | ||
| * Backward compatibility is maintained via a compatibility proxy, though | ||
| * new code should prefer the named utilities (loadApp, hasApp, etc.). | ||
| */ | ||
vishwamartur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { lazyAppStore } from "./lazy-loader"; | ||
|
|
||
| function createCachedImport<T>(importFunc: () => Promise<T>): () => Promise<T> { | ||
| let cachedModule: T | undefined; | ||
| // Export the lazy app store as the default export | ||
| // This maintains backward compatibility with existing imports | ||
| export default lazyAppStore; | ||
|
|
||
| return async () => { | ||
| if (!cachedModule) { | ||
| cachedModule = await importFunc(); | ||
| } | ||
| return cachedModule; | ||
| }; | ||
| } | ||
|
|
||
| const exportedAppStore: typeof appStore & { | ||
| ["mock-payment-app"]?: () => Promise<typeof import("./mock-payment-app/index")>; | ||
| } = appStore; | ||
|
|
||
| if (process.env.MOCK_PAYMENT_APP_ENABLED !== undefined) { | ||
| exportedAppStore["mock-payment-app"] = createCachedImport(() => import("./mock-payment-app/index")); | ||
| } | ||
|
|
||
| export default exportedAppStore; | ||
| // Re-export utilities for direct usage | ||
| export { loadApp, hasApp, getAvailableApps, preloadApps, clearAppCache } from "./lazy-loader"; | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "name": "Insights", | ||
| "slug": "insights", | ||
| "type": "insights_analytics", | ||
| "logo": "icon.svg", | ||
| "url": "https://cal.com/", | ||
| "variant": "analytics", | ||
| "categories": ["analytics"], | ||
| "publisher": "Cal.com, Inc.", | ||
| "email": "help@cal.com", | ||
| "description": "Insights is an all-in-one platform for businesses looking to track user behavior, optimize workflows, and make data-driven decisions. Whether you are a marketer, product manager, or part of a customer success team, Insights provides the tools you need to succeed.", | ||
| "extendsFeature": "EventType", | ||
| "appData": { | ||
| "tag": { | ||
| "scripts": [ | ||
| { | ||
| "src": "https://collector.insights.com/script.js", | ||
vishwamartur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "attrs": { | ||
| "defer": true, | ||
| "crossorigin": "anonymous", | ||
| "referrerpolicy": "strict-origin-when-cross-origin", | ||
| "data-website-id": "{SITE_ID}" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "isTemplate": false, | ||
| "__createdUsingCli": true, | ||
| "__template": "booking-pages-tag" | ||
| } | ||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "private": true, | ||
| "name": "@calcom/insights", | ||
| "version": "0.0.0", | ||
| "main": "./index.ts", | ||
| "dependencies": { | ||
| "@calcom/lib": "*" | ||
| }, | ||
| "devDependencies": { | ||
| "@calcom/types": "*" | ||
| }, | ||
| "description": "Insights is an all-in-one platform for businesses looking to track user behavior, optimize workflows, and make data-driven decisions. Whether you are a marketer, product manager, or part of a customer success team, Insights provides the tools you need to succeed." | ||
| } |
File renamed without changes
File renamed without changes
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.