From 014f1986debdf6a7900854e0582a9622ae541356 Mon Sep 17 00:00:00 2001 From: Leo Giovanetti Date: Tue, 18 Apr 2023 13:48:19 -0300 Subject: [PATCH] Adding missing mutation (#8357) * Adding missing mutation * Returning to prop for disabled --- packages/app-store/components.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/app-store/components.tsx b/packages/app-store/components.tsx index 3dc14e2395..5630b56ffd 100644 --- a/packages/app-store/components.tsx +++ b/packages/app-store/components.tsx @@ -2,6 +2,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import { useEffect, useRef } from "react"; +import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation"; import classNames from "@calcom/lib/classNames"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { CAL_URL } from "@calcom/lib/constants"; @@ -20,10 +21,21 @@ export const InstallAppButtonWithoutPlanCheck = ( type: App["type"]; } & InstallAppButtonProps ) => { + const mutation = useAddAppMutation(null); const key = deriveAppDictKeyFromType(props.type, InstallAppButtonMap); const InstallAppButtonComponent = InstallAppButtonMap[key as keyof typeof InstallAppButtonMap]; if (!InstallAppButtonComponent) - return <>{props.render({ useDefaultComponent: true, disabled: props.disableInstall })}; + return ( + <> + {props.render({ + useDefaultComponent: true, + disabled: props.disableInstall, + onClick: () => { + mutation.mutate({ type: props.type }); + }, + })} + + ); return (