From 98779838aba4c1ce0544ddf2ec02f30492047206 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Mon, 29 Sep 2025 22:01:46 +0200 Subject: [PATCH] FolderPicker: Don't show parent folder when not searching (#111756) --- .../components/NestedFolderPicker/NestedFolderList.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx b/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx index 1b9bea1c415..883171532a7 100644 --- a/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx +++ b/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx @@ -173,6 +173,11 @@ function Row({ index, style: virtualStyles, data }: RowProps) { ) : null; } + // We don't have a direct value of whether things are coming from user searching but this seems to be a good + // approximation as when searching all items will be at top level, while things that are actually in the top level + // when just looking at a folders tree should not have parent. + const isSearchItem = level === 0 && item.parentUID !== undefined; + return ( // don't need a key handler here, it's handled at the input level in NestedFolderPicker // eslint-disable-next-line jsx-a11y/click-events-have-key-events @@ -222,7 +227,7 @@ function Row({ index, style: virtualStyles, data }: RowProps) { {item.title} - + {isSearchItem && } );