[unified-selection] Expose clear storage event source name#1396
Merged
Conversation
🦋 Changeset detectedLatest commit: 807dc8b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
Pull request overview
Exposes a public constant identifying the event source used when SelectionStorage.clearStorage clears selection, enabling consumers to ignore/short-circuit selection-change handling during storage clears (e.g., iModel close).
Changes:
- Introduces and exports
CLEAR_SELECTION_STORAGE_SOURCEas a public API constant. - Updates internal usages to emit and detect the new clear-storage source constant.
- Updates API report files and adds a changeset for the new public export.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/unified-selection/src/unified-selection/SelectionStorage.ts | Adds CLEAR_SELECTION_STORAGE_SOURCE and uses it when clearStorage triggers a clear event. |
| packages/unified-selection/src/unified-selection/IModelHiliteSetProvider.ts | Updates listener logic to use the new exported clear-storage source constant. |
| packages/unified-selection/src/unified-selection.ts | Re-exports CLEAR_SELECTION_STORAGE_SOURCE from the package entrypoint. |
| packages/unified-selection/api/unified-selection.exports.csv | Records the new public export in the API exports list. |
| packages/unified-selection/api/unified-selection.api.md | Updates the API report to include the new public constant. |
| .changeset/good-ghosts-dress.md | Adds a minor changeset documenting the newly exposed constant. |
Contributor
There was a problem hiding this comment.
Unified selection benchmark
| Benchmark suite | Current: 807dc8b | Previous: b45481d | Deviation | Status |
|---|---|---|---|---|
compute selection for 50k elements |
392 ms |
382 ms |
2.62% |
〰️ |
compute selection for 50k elements (P95 of main thread blocks) |
31 ms |
32 ms |
-3.13% |
〰️ |
compute parent selection for 50k elements |
352 ms |
350 ms |
0.57% |
〰️ |
compute parent selection for 50k elements (P95 of main thread blocks) |
31 ms |
31 ms |
0% |
🟰 |
compute top ancestor selection for 50k elements |
559 ms |
570 ms |
-1.93% |
〰️ |
compute top ancestor selection for 50k elements (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
compute category selection for 50k elements |
102 ms |
103 ms |
-0.97% |
〰️ |
compute category selection for 50k elements (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
compute model selection for 50k elements |
84 ms |
74 ms |
13.51% |
〰️ |
compute model selection for 50k elements (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
compute functional selection for 50k 3D elements |
432 ms |
422 ms |
2.37% |
〰️ |
compute functional selection for 50k 3D elements (P95 of main thread blocks) |
36 ms |
35 ms |
2.86% |
〰️ |
compute parent functional selection for 50k 3D elements |
465 ms |
443 ms |
4.97% |
〰️ |
compute parent functional selection for 50k 3D elements (P95 of main thread blocks) |
31 ms |
35 ms |
-11.43% |
〰️ |
compute top ancestor functional selection for 50k 3D elements |
1202 ms |
1172 ms |
2.56% |
〰️ |
compute top ancestor functional selection for 50k 3D elements (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
compute functional selection for 50k 2D elements |
3059 ms |
3074 ms |
-0.49% |
〰️ |
compute functional selection for 50k 2D elements (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
compute parent functional selection for 50k 2D elements |
2868 ms |
3000 ms |
-4.40% |
〰️ |
compute parent functional selection for 50k 2D elements (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
compute top ancestor functional selection for 50k 2D elements |
2934 ms |
3071 ms |
-4.46% |
〰️ |
compute top ancestor functional selection for 50k 2D elements (P95 of main thread blocks) |
0 ms |
0 ms |
0% |
🟰 |
hilite 50k elements |
1172 ms |
1250 ms |
-6.24% |
〰️ |
hilite 50k elements (P95 of main thread blocks) |
53 ms |
55 ms |
-3.64% |
〰️ |
hilite 50k group elements |
239 ms |
229 ms |
4.37% |
〰️ |
hilite 50k group elements (P95 of main thread blocks) |
35 ms |
31 ms |
12.90% |
〰️ |
hilite 1k subjects |
48217 ms |
45731 ms |
5.44% |
〰️ |
hilite 1k subjects (P95 of main thread blocks) |
0 ms |
26 ms |
-100% |
〰️ |
hilite 50k subcategories |
309 ms |
304 ms |
1.64% |
〰️ |
hilite 50k subcategories (P95 of main thread blocks) |
41 ms |
41 ms |
0% |
🟰 |
hilite 50k functional 3D elements |
29827 ms |
31855 ms |
-6.37% |
〰️ |
hilite 50k functional 3D elements (P95 of main thread blocks) |
39 ms |
40 ms |
-2.50% |
〰️ |
hilite 50k functional 2D elements |
6610 ms |
6870 ms |
-3.78% |
〰️ |
hilite 50k functional 2D elements (P95 of main thread blocks) |
39 ms |
42 ms |
-7.14% |
〰️ |
This comment was automatically generated by workflow using github-action-benchmark.
grigasp
approved these changes
Jun 10, 2026
Co-authored-by: Grigas <35135765+grigasp@users.noreply.github.com>
…ELECTION_STORAGE_SOURCE Add assertion to verify clearStorage triggers selectionChangeEvent with the correct source constant, preventing accidental regressions if the source string changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Closes #1395
Expose
CLEAR_SELECTION_STORAGE_SOURCEname that is used as event source when selection storage is cleared. This allows consumers to bail out of handling selection change when selection storage is cleared.