From 1b2dc6c815c298bea792f3d9a1e0fd88d52a0578 Mon Sep 17 00:00:00 2001 From: Boris Bera Date: Mon, 26 Feb 2024 16:03:46 -0500 Subject: [PATCH] Appease typescript Signed-off-by: Boris Bera --- .../catalog/src/components/CatalogTable/columns.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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(', ')