fix: installed

This commit is contained in:
Joel 2024-11-28 14:13:43 +08:00
parent 3e601c4ef5
commit 073e847524

View File

@ -1,6 +1,6 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import React, { useEffect } from 'react'
import type { PluginDeclaration } from '../../../types'
import Card from '../../../card'
import { pluginManifestToCardPluginProps } from '../../utils'
@ -42,6 +42,11 @@ const Installed: FC<Props> = ({
const installedVersion = installedInfoPayload?.installedVersion
const hasInstalled = !!installedVersion
useEffect(() => {
if (hasInstalled && toInstallVersion === installedVersion)
onInstalled()
}, [hasInstalled, toInstallVersion, installedVersion])
const [isInstalling, setIsInstalling] = React.useState(false)
const { mutateAsync: installPackageFromLocal } = useInstallPackageFromLocal()
const { mutateAsync: updatePackageFromMarketPlace } = useUpdatePackageFromMarketPlace()