Skip to content

[unified-selection] Expose clear storage event source name#1396

Merged
saskliutas merged 5 commits into
masterfrom
expose-clear-storage-event-source
Jun 10, 2026
Merged

[unified-selection] Expose clear storage event source name#1396
saskliutas merged 5 commits into
masterfrom
expose-clear-storage-event-source

Conversation

@saskliutas

Copy link
Copy Markdown
Member

Closes #1395

Expose CLEAR_SELECTION_STORAGE_SOURCE name 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.

Copilot AI review requested due to automatic review settings June 9, 2026 15:24
@saskliutas saskliutas requested a review from a team as a code owner June 9, 2026 15:24
@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 807dc8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@itwin/unified-selection Minor

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

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

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_SOURCE as 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.

@github-actions github-actions Bot 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.

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.

Comment thread .changeset/good-ghosts-dress.md Outdated
saskliutas and others added 3 commits June 10, 2026 09:44
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>
@saskliutas saskliutas merged commit 1c319fd into master Jun 10, 2026
16 checks passed
@saskliutas saskliutas deleted the expose-clear-storage-event-source branch June 10, 2026 06:57
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.

Export IMODEL_CLOSE_SELECTION_CLEAR_SOURCE from unified-selection

3 participants