mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Filter null/undefined first
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
1 file changed
+3
-1
@@ -65,7 +65,9 @@ export class CatalogEntityRegistry {
|
|||||||
|
|
||||||
getItemsForCategory<T extends CatalogEntity>(category: CatalogCategory): T[] {
|
getItemsForCategory<T extends CatalogEntity>(category: CatalogCategory): T[] {
|
||||||
const supportedVersions = category.spec.versions.map((v) => `${category.spec.group}/${v.name}`);
|
const supportedVersions = category.spec.versions.map((v) => `${category.spec.group}/${v.name}`);
|
||||||
const items = this._items.filter((item) => supportedVersions.includes(item?.apiVersion) && item.kind === category.spec.names.kind);
|
const items = this._items
|
||||||
|
.filter(Boolean)
|
||||||
|
.filter((item) => supportedVersions.includes(item.apiVersion) && item.kind === category.spec.names.kind);
|
||||||
|
|
||||||
return items as T[];
|
return items as T[];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user