fix: from marketplace install and update bundle

This commit is contained in:
Joel 2024-11-28 18:47:06 +08:00
parent 32619bd05e
commit 47579c86e6
3 changed files with 7 additions and 6 deletions

View File

@ -136,9 +136,9 @@ const InstallByDSLList: FC<Props> = ({
const isLoadedAllData = (plugins.filter(p => !!p).length + errorIndexes.length) === allPlugins.length
const { installedInfo, isLoading: isLoadingCheckInstalled } = useCheckInstalled({
const { installedInfo } = useCheckInstalled({
pluginIds: plugins?.filter(p => !!p).map((d) => {
return `${d?.org}/${d?.name}`
return `${d?.org || d?.author}/${d?.name}`
}) || [],
enabled: isLoadedAllData,
})
@ -182,7 +182,7 @@ const InstallByDSLList: FC<Props> = ({
dependency={d as GitHubItemAndMarketPlaceDependency}
onFetchedPayload={handleGitHubPluginFetched(index)}
onFetchError={handleGitHubPluginFetchError(index)}
versionInfo={getVersionInfo(`${plugin?.org}/${plugin?.name}`)}
versionInfo={getVersionInfo(`${plugin?.org || plugin?.author}/${plugin?.name}`)}
/>)
}
@ -194,7 +194,7 @@ const InstallByDSLList: FC<Props> = ({
onCheckedChange={handleSelect(index)}
payload={plugins[index] as Plugin}
version={(d as GitHubItemAndMarketPlaceDependency).value.version!}
versionInfo={getVersionInfo(`${plugin?.org}/${plugin?.name}`)}
versionInfo={getVersionInfo(`${plugin?.org || plugin?.author}/${plugin?.name}`)}
/>
)
}
@ -207,7 +207,7 @@ const InstallByDSLList: FC<Props> = ({
onCheckedChange={handleSelect(index)}
payload={d as PackageDependency}
isFromMarketPlace={isFromMarketPlace}
versionInfo={getVersionInfo(`${plugin?.org}/${plugin?.name}`)}
versionInfo={getVersionInfo(`${plugin?.org || plugin?.author}/${plugin?.name}`)}
/>
)
})

View File

@ -109,6 +109,7 @@ export type PluginDetail = {
export type Plugin = {
type: 'plugin' | 'bundle'
org: string
author?: string
name: string
plugin_id: string
version: string

View File

@ -163,7 +163,7 @@ export const useInstallOrUpdate = ({
return Promise.all(payload.map(async (item, i) => {
try {
const orgAndName = `${plugin[i]?.org}/${plugin[i]?.name}`
const orgAndName = `${plugin[i]?.org || plugin[i]?.author}/${plugin[i]?.name}`
const installedPayload = installedInfo[orgAndName]
const isInstalled = !!installedPayload
let uniqueIdentifier = ''