FolderPicker: Don't show parent folder when not searching (#111756)

This commit is contained in:
Andrej Ocenas 2025-09-29 22:01:46 +02:00 committed by GitHub
parent a9ef73607d
commit 98779838ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -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) {
<Text truncate>{item.title}</Text>
<FolderRepo folder={item} />
</label>
<FolderParent item={items[index]} />
{isSearchItem && <FolderParent item={items[index]} />}
</div>
</div>
);