fix: when error can not install

This commit is contained in:
Joel 2024-11-19 17:29:02 +08:00
parent a093a48675
commit e151c2ee8c
2 changed files with 9 additions and 5 deletions

View File

@ -30,8 +30,12 @@ const InstallByDSLList: FC<Props> = ({
return []
const _plugins = allPlugins.map((d) => {
if (d.type === 'package')
return (d as any).value.manifest
if (d.type === 'package') {
return {
...(d as any).value.manifest,
plugin_id: (d as any).value.unique_identifier,
}
}
return undefined
})
@ -84,7 +88,7 @@ const InstallByDSLList: FC<Props> = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isFetchingMarketplaceData])
const isLoadedAllData = allPlugins.length === plugins.length && plugins.every(p => !!p)
const isLoadedAllData = (plugins.filter(p => !!p).length + errorIndexes.length) === allPlugins.length
useEffect(() => {
if (isLoadedAllData)
onLoadedAllPlugin()

View File

@ -5,7 +5,7 @@ import type { Dependency, InstallStatusResponse, Plugin } from '../../../types'
import Button from '@/app/components/base/button'
import { RiLoader2Line } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import InstallByDSLList from './install-multi'
import InstallMulti from './install-multi'
import { useInstallFromMarketplaceAndGitHub } from '@/service/use-plugins'
import { useInvalidateInstalledPluginList } from '@/service/use-plugins'
const i18nPrefix = 'plugin.installModal'
@ -67,7 +67,7 @@ const Install: FC<Props> = ({
<p>{t(`${i18nPrefix}.${selectedPluginsNum > 1 ? 'readyToInstallPackages' : 'readyToInstallPackage'}`, { num: selectedPluginsNum })}</p>
</div>
<div className='w-full p-2 rounded-2xl bg-background-section-burn space-y-1'>
<InstallByDSLList
<InstallMulti
allPlugins={allPlugins}
selectedPlugins={selectedPlugins}
onSelect={handleSelect}