Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

show no results for un-matching query in hierarchy tree #10415

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ function HierarchyPanelContents(props: { sceneURL: string; rootEntityUUID: Entit
[entityHierarchy]
)

const nodeSearch: HeirarchyTreeNodeType[] = []
const searchedNodes: HeirarchyTreeNodeType[] = []
if (searchHierarchy.value.length > 0) {
const condition = new RegExp(searchHierarchy.value.toLowerCase())
entityHierarchy.value.forEach((node) => {
if (node.entity && condition.test(getComponent(node.entity, NameComponent)?.toLowerCase() ?? ''))
nodeSearch.push(node)
searchedNodes.push(node)
})
}

Expand Down Expand Up @@ -412,7 +412,7 @@ function HierarchyPanelContents(props: { sceneURL: string; rootEntityUUID: Entit
}
})

let validNodes = nodeSearch?.length > 0 ? nodeSearch : entityHierarchy.value
let validNodes = searchHierarchy.value.length > 0 ? searchedNodes : entityHierarchy.value
validNodes = validNodes.filter((node) => entityExists(node.entity))

const HierarchyList = ({ height, width }) => (
Expand All @@ -427,7 +427,6 @@ function HierarchyPanelContents(props: { sceneURL: string; rootEntityUUID: Entit
onKeyDown,
onChangeName,
onRenameSubmit,
onMouseDown,
onClick,
onToggle,
onUpload
Expand Down
Loading