From 6d45566be38a04558647042fa57b15d61874ad1a Mon Sep 17 00:00:00 2001 From: Apoorv Mishra Date: Sat, 28 Jan 2023 19:59:59 +0530 Subject: [PATCH] fix: missing collection name in path in explorer search results (#4793) --- app/components/DocumentExplorerSearchResult.tsx | 2 +- app/utils/tree.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/DocumentExplorerSearchResult.tsx b/app/components/DocumentExplorerSearchResult.tsx index 094be170f..bb4675851 100644 --- a/app/components/DocumentExplorerSearchResult.tsx +++ b/app/components/DocumentExplorerSearchResult.tsx @@ -73,7 +73,7 @@ const Title = styled(Text)` `; const Path = styled(Text)<{ $selected: boolean }>` - padding-top: 3px; + padding-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/app/utils/tree.ts b/app/utils/tree.ts index 33ccdde76..e5b464f8a 100644 --- a/app/utils/tree.ts +++ b/app/utils/tree.ts @@ -15,11 +15,11 @@ export const flattenTree = (root: NavigationNode) => { return flattened; }; -export const ancestors = (node: NavigationNode) => { +export const ancestors = (node: NavigationNode | null) => { const ancestors: NavigationNode[] = []; - while (node.parent !== null) { + while (node !== null) { ancestors.unshift(node); - node = node.parent as NavigationNode; + node = node.parent as NavigationNode | null; } return ancestors; };