[Tree widget]: cleanup on next#1711
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 separatesearchTargetElements/nonSearchTargetElementsarrays. - Introduces
ChildrenTreenamespace utilities and addsgetId64Spreadablehelper; updatesAlwaysAndNeverDrawnElementInfoCacheand 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.
There was a problem hiding this comment.
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.
grigasp
reviewed
Jun 9, 2026
grigasp
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracting cleanup parts from #1678:
ChildrenTreeutilities: moving standalone functions (getIdsFromChildrenTree,updateChildrenTree) into aChildrenTreenamespace ascollectandupdatemodelIdsfrom 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).getId64SpreadablehelperAlwaysAndNeverDrawnElementInfoCacheto use changes from 1.