diff --git a/.changeset/green-vans-peel.md b/.changeset/green-vans-peel.md new file mode 100644 index 0000000000..cd4d30139a --- /dev/null +++ b/.changeset/green-vans-peel.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Fix `EntityTypeFilter` so it produces unique case-insensitive set of available types diff --git a/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx b/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx index 068e995522..5fa6b0f1a2 100644 --- a/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx +++ b/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx @@ -86,10 +86,11 @@ export function useEntityTypeFilter(): EntityTypeReturn { const countByType = entities.reduce((acc, entity) => { if (typeof entity.spec?.type !== 'string') return acc; - if (!acc[entity.spec.type]) { - acc[entity.spec.type] = 0; + const entityType = entity.spec.type.toLocaleLowerCase('en-US'); + if (!acc[entityType]) { + acc[entityType] = 0; } - acc[entity.spec.type] += 1; + acc[entityType] += 1; return acc; }, {} as Record);