diff --git a/web/app/components/plugins/card/__tests__/index.spec.tsx b/web/app/components/plugins/card/__tests__/index.spec.tsx index 37cdd58985..b6c97dfd02 100644 --- a/web/app/components/plugins/card/__tests__/index.spec.tsx +++ b/web/app/components/plugins/card/__tests__/index.spec.tsx @@ -465,6 +465,14 @@ describe('Card', () => { expect(screen.queryByTestId('partner-badge')).not.toBeInTheDocument() }) + + it('should handle null badges from the marketplace API', () => { + const plugin = createMockPlugin({ badges: null }) + + render() + + expect(screen.queryByTestId('partner-badge')).not.toBeInTheDocument() + }) }) // ================================ diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx index 3208d97969..d0202f2b35 100644 --- a/web/app/components/plugins/card/index.tsx +++ b/web/app/components/plugins/card/index.tsx @@ -53,7 +53,8 @@ const Card = ({ const { t } = useTranslation() const { categoriesMap } = useCategories(true) const currentWorkspaceId = useSelector(s => s.currentWorkspace.id) - const { category, type, name, org, label, brief, icon, icon_dark, verified, badges = [], from } = payload + const { category, type, name, org, label, brief, icon, icon_dark, verified, from } = payload + const badges = payload.badges ?? [] const { theme } = useTheme() const iconSrc = getPluginCardIconUrl( { from, name, org, type }, diff --git a/web/app/components/plugins/types.ts b/web/app/components/plugins/types.ts index 0f03e17a05..6053464a7a 100644 --- a/web/app/components/plugins/types.ts +++ b/web/app/components/plugins/types.ts @@ -190,7 +190,7 @@ export type PluginManifestInMarket = { introduction: string verified: boolean install_count: number - badges: string[] + badges: string[] | null verification: { authorized_category: 'langgenius' | 'partner' | 'community' } @@ -255,7 +255,7 @@ export type Plugin = { settings: CredentialFormSchemaBase[] } tags: { name: string }[] - badges: string[] + badges: string[] | null verification: { authorized_category: 'langgenius' | 'partner' | 'community' }