Skip to content

[Tree widget]: cleanup on next#1711

Merged
JonasDov merged 6 commits into
tree-widget/nextfrom
JonasD/cleanup
Jun 11, 2026
Merged

[Tree widget]: cleanup on next#1711
JonasDov merged 6 commits into
tree-widget/nextfrom
JonasD/cleanup

Conversation

@JonasDov

@JonasDov JonasDov commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Extracting cleanup parts from #1678:

  1. Refactoring ChildrenTree utilities: moving standalone functions (getIdsFromChildrenTree, updateChildrenTree) into a ChildrenTree namespace as collect and update
  2. Simplifying element targets.
  3. Removing unused modelIds from categories tree search targets. (only models in categories tree are sub-models and they can never be search targets, since sub-model nodes are hidden).
  4. Adding getId64Spreadable helper
  5. Refactoring AlwaysAndNeverDrawnElementInfoCache to use changes from 1.
  6. Adjustments across all three search results trees (categories, classifications, models): Renamed types for clarity.
  7. Test app: showing elements in categories tree.

Copilot AI review requested due to automatic review settings June 5, 2026 12:48
@JonasDov JonasDov requested review from a team as code owners June 5, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors search-results tree handling and visibility targeting across the tree-widget (models, categories, classifications) to simplify element targeting, align node-handler APIs, and centralize ChildrenTree utilities, plus a small test-viewer config tweak.

Changes:

  • Refactors search-results tree node handler APIs (getProcessedNodes, createNode) and updates all three search-results trees accordingly.
  • Simplifies element visibility targets by replacing Map<ElementId, { isSearchTarget: boolean }> with separate searchTargetElements / nonSearchTargetElements arrays.
  • Introduces ChildrenTree namespace utilities and adds getId64Spreadable helper; updates AlwaysAndNeverDrawnElementInfoCache and visibility helper callsites.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/itwin/tree-widget/src/tree-widget-react/components/trees/models-tree/internal/visibility/SearchResultsTree.ts Refactors models-tree search-results node types and element target shape (arrays).
packages/itwin/tree-widget/src/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.ts Adapts models-tree visibility changes to new element target arrays.
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.ts Uses getId64Spreadable to simplify spreading Id64Arg.
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/visibility/BaseSearchResultsTree.ts Renames/aligns handler API (getProcessedNodes, createNode).
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/Utils.ts Introduces ChildrenTree namespace (collect, update) and getId64Spreadable.
packages/itwin/tree-widget/src/tree-widget-react/components/trees/common/internal/caches/AlwaysAndNeverDrawnElementInfoCache.ts Switches to ChildrenTree.update/collect utilities.
packages/itwin/tree-widget/src/tree-widget-react/components/trees/classifications-tree/internal/visibility/SearchResultsTree.ts Refactors classifications-tree search-results node types and element target shape (arrays).
packages/itwin/tree-widget/src/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.ts Adapts classifications-tree visibility changes to new element target arrays.
packages/itwin/tree-widget/src/tree-widget-react/components/trees/categories-tree/internal/visibility/SearchResultsTree.ts Refactors categories-tree search-results node types (incl. subModel) and element target shape (arrays); removes modelIds targets.
packages/itwin/tree-widget/src/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.ts Removes modelId search-target handling; adapts to new element target arrays.
apps/test-viewer/src/UiProvidersConfig.tsx Enables showing elements in the categories tree via hierarchyConfig.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tree-Widget Next benchmark

Benchmark suite Current: d9ddc43 Previous: 5ee3336 Deviation Status
models tree 50k 3D elements search > get search paths 1272 ms 1293 ms -1.62% 〰️
models tree 50k 3D elements search > get search paths (P95 of main thread blocks) 55 ms 55 ms 0% 🟰
models tree 50k 3D elements search > load hierarchy from search paths 117766 ms 106628 ms 10.45% 🚨
models tree 50k 3D elements search > load hierarchy from search paths (P95 of main thread blocks) 37 ms 35 ms 5.71% 〰️
models tree 50k categories > collect nodes 3067 ms 3026 ms 1.35% 〰️
models tree 50k categories > collect nodes (P95 of main thread blocks) 117 ms 110 ms 6.36% 〰️
models tree 50k categories > validate initial visibility 2083 ms 1922 ms 8.38% 〰️
models tree 50k categories > validate initial visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k categories > change visibility 234 ms 200 ms 17% 〰️
models tree 50k categories > change visibility (P95 of main thread blocks) 75 ms 52 ms 44.23% 〰️
models tree 50k categories > validate changed visibility 3938 ms 3510 ms 12.19% 🚨
models tree 50k categories > validate changed visibility (P95 of main thread blocks) 29 ms 23 ms 26.09% 〰️
models tree 50k 3D elements > collect nodes 46280 ms 41613 ms 11.22% 🚨
models tree 50k 3D elements > collect nodes (P95 of main thread blocks) 69 ms 67 ms 2.99% 〰️
models tree 50k 3D elements > validate initial visibility 1418 ms 1420 ms -0.14% 〰️
models tree 50k 3D elements > validate initial visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k 3D elements > change model visibility 99 ms 101 ms -1.98% 〰️
models tree 50k 3D elements > change model visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k 3D elements > validate changed model visibility 2172 ms 2104 ms 3.23% 〰️
models tree 50k 3D elements > validate changed model visibility (P95 of main thread blocks) 41 ms 108 ms -62.04%
models tree 50k 3D elements > change category node visibility 530 ms 516 ms 2.71% 〰️
models tree 50k 3D elements > change category node visibility (P95 of main thread blocks) 64 ms 60 ms 6.67% 〰️
models tree 50k 3D elements > validate changed category visibility 1490 ms 1425 ms 4.56% 〰️
models tree 50k 3D elements > validate changed category visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k 3D elements > validate per-model category override 1470 ms 1391 ms 5.68% 〰️
models tree 50k 3D elements > validate per-model category override (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k 3D elements > change element visibility 34 ms 33 ms 3.03% 〰️
models tree 50k 3D elements > change element visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k 3D elements > validate changed element visibility 2336 ms 2198 ms 6.28% 〰️
models tree 50k 3D elements > validate changed element visibility (P95 of main thread blocks) 83 ms 69 ms 20.29% 〰️
models tree 50k 3D child elements with different categories > collect nodes 45887 ms 41511 ms 10.54% 🚨
models tree 50k 3D child elements with different categories > collect nodes (P95 of main thread blocks) 96 ms 56 ms 71.43% 〰️
models tree 50k 3D child elements with different categories > validate initial visibility 1402 ms 1371 ms 2.26% 〰️
models tree 50k 3D child elements with different categories > validate initial visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k 3D child elements with different categories > change visibility 46 ms 52 ms -11.54% 〰️
models tree 50k 3D child elements with different categories > change visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
models tree 50k 3D child elements with different categories > validate changed visibility 2817 ms 2742 ms 2.74% 〰️
models tree 50k 3D child elements with different categories > validate changed visibility (P95 of main thread blocks) 88 ms 76 ms 15.79% 〰️
categories tree 50k subCategories search > get search paths 1904 ms 1898 ms 0.32% 〰️
categories tree 50k subCategories search > get search paths (P95 of main thread blocks) 47 ms 44 ms 6.82% 〰️
categories tree 50k subCategories search > load hierarchy from search paths 5767 ms 5695 ms 1.26% 〰️
categories tree 50k subCategories search > load hierarchy from search paths (P95 of main thread blocks) 60 ms 61 ms -1.64% 〰️
categories tree 50k subCategories > collect nodes 6205 ms 6054 ms 2.49% 〰️
categories tree 50k subCategories > collect nodes (P95 of main thread blocks) 37 ms 45 ms -17.78% 〰️
categories tree 50k subCategories > validate initial visibility 1199 ms 1163 ms 3.10% 〰️
categories tree 50k subCategories > validate initial visibility (P95 of main thread blocks) 22 ms 22 ms 0% 🟰
categories tree 50k subCategories > change visibility 361 ms 348 ms 3.74% 〰️
categories tree 50k subCategories > change visibility (P95 of main thread blocks) 29 ms 31 ms -6.45% 〰️
categories tree 50k subCategories > validate changed visibility 1076 ms 1069 ms 0.65% 〰️
categories tree 50k subCategories > validate changed visibility (P95 of main thread blocks) 36 ms 37 ms -2.70% 〰️
categories tree 50k categories > collect nodes 2558 ms 2551 ms 0.27% 〰️
categories tree 50k categories > collect nodes (P95 of main thread blocks) 145 ms 130 ms 11.54% 〰️
categories tree 50k categories > validate initial visibility 5478 ms 5068 ms 8.09% 〰️
categories tree 50k categories > validate initial visibility (P95 of main thread blocks) 178 ms 139 ms 28.06% 〰️
categories tree 50k categories > change visibility 810 ms 732 ms 10.66% 🚨
categories tree 50k categories > change visibility (P95 of main thread blocks) 65 ms 56 ms 16.07% 〰️
categories tree 50k categories > validate changed visibility 5454 ms 4796 ms 13.72% 🚨
categories tree 50k categories > validate changed visibility (P95 of main thread blocks) 48 ms 37 ms 29.73% 〰️
classifications tree 50k classifications search > get search paths 2196 ms 2240 ms -1.96% 〰️
classifications tree 50k classifications search > get search paths (P95 of main thread blocks) 147 ms 121 ms 21.49% 〰️
classifications tree 50k classifications search > load hierarchy from search paths 71806 ms 65176 ms 10.17% 🚨
classifications tree 50k classifications search > load hierarchy from search paths (P95 of main thread blocks) 28 ms 29 ms -3.45% 〰️
classifications tree 50k classifications > collect nodes 39507 ms 34607 ms 14.16% 🚨
classifications tree 50k classifications > collect nodes (P95 of main thread blocks) 102 ms 85 ms 20% 〰️
classifications tree 50k classifications > validate initial visibility 3983 ms 3691 ms 7.91% 〰️
classifications tree 50k classifications > validate initial visibility (P95 of main thread blocks) 62 ms 76 ms -18.42% 〰️
classifications tree 50k classifications > change visibility 30 ms 34 ms -11.76% 〰️
classifications tree 50k classifications > change visibility (P95 of main thread blocks) 0 ms 0 ms 0% 🟰
classifications tree 50k classifications > validate changed visibility 4150 ms 3903 ms 6.33% 〰️
classifications tree 50k classifications > validate changed visibility (P95 of main thread blocks) 91 ms 179 ms -49.16%

This comment was automatically generated by workflow using github-action-benchmark.

@JonasDov JonasDov enabled auto-merge (squash) June 10, 2026 12:56
@JonasDov JonasDov merged commit 06a7e7c into tree-widget/next Jun 11, 2026
11 checks passed
@JonasDov JonasDov deleted the JonasD/cleanup branch June 11, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants