File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ export default function AppCard({
116116 < OmniInstallAppButton
117117 className = "ml-auto flex items-center"
118118 appId = { app . slug }
119+ app = { app }
119120 returnTo = { returnTo }
120121 teamId = { teamId }
121122 onAppInstallSuccess = { onAppInstallSuccess }
Original file line number Diff line number Diff line change @@ -5,27 +5,37 @@ import { Button } from "@calcom/ui/components/button";
55import { showToast } from "@calcom/ui/components/toast" ;
66
77import { InstallAppButton } from "../InstallAppButton" ;
8+ import type { AppCardApp } from "../types" ;
89import useAddAppMutation from "../_utils/useAddAppMutation" ;
910
11+ type AppData = Pick < AppCardApp , "type" | "variant" | "slug" | "teamsPlanRequired" > ;
12+
1013/**
1114 * Use this component to allow installing an app from anywhere on the app.
12- * Use of this component requires you to remove custom InstallAppButtonComponent so that it can manage the redirection itself
15+ * Use of this component requires you to remove custom InstallAppButtonComponent so that it can manage the redirection itself.
16+ *
17+ * When `app` prop is provided, it will use that data directly instead of fetching via useApp.
18+ * This is useful when the app data is already available (e.g., from the integrations query)
19+ * to avoid redundant API calls that can cause URL length issues when batched.
1320 */
1421export default function OmniInstallAppButton ( {
1522 appId,
23+ app : appProp ,
1624 className,
1725 returnTo,
1826 teamId,
1927 onAppInstallSuccess,
2028} : {
2129 appId : string ;
30+ app ?: AppData ;
2231 className : string ;
2332 onAppInstallSuccess : ( ) => void ;
2433 returnTo ?: string ;
2534 teamId ?: number ;
2635} ) {
2736 const { t } = useLocale ( ) ;
28- const { data : app } = useApp ( appId ) ;
37+ const { data : fetchedApp } = useApp ( appId , { enabled : ! appProp } ) ;
38+ const app = appProp ?? fetchedApp ;
2939
3040 const mutation = useAddAppMutation ( null , {
3141 returnTo,
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ import { useSession } from "next-auth/react";
22
33import { trpc } from "@calcom/trpc/react" ;
44
5- export default function useApp ( appId : string ) {
5+ export default function useApp ( appId : string , options ?: { enabled ?: boolean } ) {
66 const { status } = useSession ( ) ;
77
88 return trpc . viewer . apps . appById . useQuery (
99 { appId } ,
1010 {
11- enabled : status === "authenticated" ,
11+ enabled : status === "authenticated" && ( options ?. enabled ?? true ) ,
1212 }
1313 ) ;
1414}
You can’t perform that action at this time.
0 commit comments