diff --git a/plugins/catalog/src/components/CatalogTable/columns.tsx b/plugins/catalog/src/components/CatalogTable/columns.tsx index a191befe59..a955aaadb9 100644 --- a/plugins/catalog/src/components/CatalogTable/columns.tsx +++ b/plugins/catalog/src/components/CatalogTable/columns.tsx @@ -87,11 +87,14 @@ export const columnFactories = Object.freeze({ title: 'Targets', field: 'entity.spec.targets', customFilterAndSearch: (query, row) => { - const targets = []; - if (Array.isArray(row.entity?.spec?.targets)) { - targets.push(...row.entity?.spec?.targets); + let targets: JsonArray = []; + if ( + row.entity?.spec?.targets && + Array.isArray(row.entity?.spec?.targets) + ) { + targets = row.entity?.spec?.targets; } else if (row.entity?.spec?.target) { - targets.push(row.entity?.spec?.target); + targets = [row.entity?.spec?.target]; } return targets .join(', ')