diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx index 72262894db..045cdde047 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx @@ -44,7 +44,12 @@ const InstallFromMarketplace: React.FC = ({ countDownFoldIntoAnim, } = useFoldAnimInto(onClose) - const [isInstalling, setIsInstalling] = useState(false) + const [isInstalling, doSetIsInstalling] = useState(false) + const setIsInstalling = useCallback((isInstalling: boolean) => { + if (!isInstalling) + clearCountDown() + doSetIsInstalling(isInstalling) + }, [clearCountDown]) const foldAnimInto = useCallback(() => { if (isInstalling) { @@ -57,7 +62,7 @@ const InstallFromMarketplace: React.FC = ({ const handleStartToInstall = useCallback(() => { setIsInstalling(true) countDownFoldIntoAnim() - }, [countDownFoldIntoAnim]) + }, [countDownFoldIntoAnim, setIsInstalling]) const getTitle = useCallback(() => { if (isBundle && step === InstallStep.installed) @@ -73,14 +78,14 @@ const InstallFromMarketplace: React.FC = ({ setStep(InstallStep.installed) refreshPluginList(manifest) setIsInstalling(false) - }, [manifest, refreshPluginList]) + }, [manifest, refreshPluginList, setIsInstalling]) const handleFailed = useCallback((errorMsg?: string) => { setStep(InstallStep.installFailed) setIsInstalling(false) if (errorMsg) setErrorMsg(errorMsg) - }, []) + }, [setIsInstalling]) return (