diff --git a/apps/meteor/client/views/marketplace/hooks/useAppInstallationHandler.tsx b/apps/meteor/client/views/marketplace/hooks/useAppInstallationHandler.tsx index c42b3b3241f2..7536891eb83a 100644 --- a/apps/meteor/client/views/marketplace/hooks/useAppInstallationHandler.tsx +++ b/apps/meteor/client/views/marketplace/hooks/useAppInstallationHandler.tsx @@ -67,30 +67,30 @@ export function useAppInstallationHandler({ throw new Error('Apps orchestrator is not available'); } - const acquireApp = useCallback(async () => { - if (action === 'purchase' && !isAppPurchased) { - try { - const data = await appsOrchestrator.buildExternalUrl(app.id, app.purchaseType, false); - setModal( - { - setIsPurchased(true); - openPermissionModal(); - }} - />, - ); - } catch (error) { - handleAPIError(error); + return useCallback(async () => { + const acquireApp = async () => { + if (action === 'purchase' && !isAppPurchased) { + try { + const data = await appsOrchestrator.buildExternalUrl(app.id, app.purchaseType, false); + setModal( + { + setIsPurchased(true); + openPermissionModal(); + }} + />, + ); + } catch (error) { + handleAPIError(error); + } + return; } - return; - } - openPermissionModal(); - }, [action, isAppPurchased, openPermissionModal, appsOrchestrator, app.id, app.purchaseType, setModal, onDismiss, setIsPurchased]); + openPermissionModal(); + }; - return useCallback(async () => { if (app?.versionIncompatible) { openIncompatibleModal(app, action, closeModal); return; @@ -147,13 +147,15 @@ export function useAppInstallationHandler({ appCountQuery.data, setModal, closeModal, - acquireApp, + isAppPurchased, + openPermissionModal, + appsOrchestrator, + onDismiss, + setIsPurchased, openIncompatibleModal, dispatchToastMessage, notifyAdmins, success, - appsOrchestrator, - onDismiss, openExternalLink, manageSubscriptionUrl, ]);