From ca0da3c32e34403491a9c68fc78e769ac06989ce Mon Sep 17 00:00:00 2001 From: Maksim Efremov Date: Wed, 7 Aug 2024 18:36:46 +0300 Subject: [PATCH] fix(Operation/Job/Statistics): handle undefined [YTFRONT-4300] --- .../ui/components/StatisticTable/prepare-statistic.ts.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/ui/components/StatisticTable/prepare-statistic.ts.ts b/packages/ui/src/ui/components/StatisticTable/prepare-statistic.ts.ts index 29e9d913d..6b3b27970 100644 --- a/packages/ui/src/ui/components/StatisticTable/prepare-statistic.ts.ts +++ b/packages/ui/src/ui/components/StatisticTable/prepare-statistic.ts.ts @@ -75,7 +75,11 @@ export function prepareMetricsTree(statistics: StatisticTree): StatisticTreeInne return metricsTree[TREE_ROOT_NAME]; } -export function filterStatisticTree(tree: StatisticTreeInner, currentFilter = '') { +export function filterStatisticTree(tree?: StatisticTreeInner, currentFilter = '') { + if (!tree) { + return []; + } + const filteredTree = hammer.treeList.filterTree( tree, (entry: MetricsEntry) => entry.name.indexOf(currentFilter) !== -1,