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

Commit

Permalink
show no results for unmatching query in hierarchy tree
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-mitra committed Jun 19, 2024
1 parent 84adaf4 commit 8017041
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit 8017041

Please sign in to comment.