fix: installed not clear countdown

This commit is contained in:
Joel 2025-01-09 10:49:15 +08:00
parent 41b720502f
commit 018e32e355
1 changed files with 9 additions and 4 deletions

View File

@ -44,7 +44,12 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({
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<InstallFromMarketplaceProps> = ({
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<InstallFromMarketplaceProps> = ({
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 (
<Modal