Skip to content

Commit

Permalink
Merge pull request #3549 from ingef/fix-search-for-nested-struct-nodes
Browse files Browse the repository at this point in the history
Don't render folder if no children match
  • Loading branch information
Kadrian authored Sep 6, 2024
2 parents 6df68b5 + 583b990 commit e871d72
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/src/js/concept-trees/ConceptTreeFolder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ConceptTree from "./ConceptTree";
import ConceptTreeNodeTextContainer from "./ConceptTreeNodeTextContainer";
import { getConceptById } from "./globalTreeStoreHelper";
import type { SearchT, TreesT } from "./reducer";
import { isNodeInSearchResult } from "./selectors";

const Root = styled("div")`
font-size: ${({ theme }) => theme.font.sm};
Expand Down Expand Up @@ -57,6 +58,12 @@ const ConceptTreeFolder: FC<PropsT> = ({
openInitially,
});

if (!search.showMismatches) {
const shouldRender = isNodeInSearchResult(conceptId, search, tree.children);

if (!shouldRender) return null;
}

const matchingEntries =
!tree.children || !tree.matchingEntries
? null
Expand Down

0 comments on commit e871d72

Please sign in to comment.