From 7e0385c9d90b290860152cfb57b9e3552028433b Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Wed, 7 Apr 2021 13:05:36 +0200 Subject: [PATCH] Skip invalid ids in dataset --- lib/ui/src/components/sidebar/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/src/components/sidebar/utils.ts b/lib/ui/src/components/sidebar/utils.ts index 017b24d80baa..8b5f156efc53 100644 --- a/lib/ui/src/components/sidebar/utils.ts +++ b/lib/ui/src/components/sidebar/utils.ts @@ -36,7 +36,7 @@ export const getDescendantIds = memoize(1000)( (data: StoriesHash, id: string, skipLeafs: boolean): string[] => { const { children = [] } = data[id] || {}; return children.reduce((acc, childId) => { - if (skipLeafs && data[childId].isLeaf) return acc; + if (!data[childId] || (skipLeafs && data[childId].isLeaf)) return acc; acc.push(childId, ...getDescendantIds(data, childId, skipLeafs)); return acc; }, []);