diff --git a/.changeset/good-ghosts-dress.md b/.changeset/good-ghosts-dress.md deleted file mode 100644 index 20db85481..000000000 --- a/.changeset/good-ghosts-dress.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -"@itwin/unified-selection": minor ---- - -Expose `CLEAR_SELECTION_STORAGE_SOURCE` constant that is used as selection change event source when selection storage is cleared. This should allow consumers to detect when selection change happened due to selection storage being cleared. - -```ts -import { createStorage, CLEAR_SELECTION_STORAGE_SOURCE } from "@itwin/unified-selection"; - -const storage = createStorage(); -storage.selectionChangeEvent.addListener((args) => { - if (args.source === CLEAR_SELECTION_STORAGE_SOURCE) { - // ignore change if it was caused by clearing selection storage - } - // handle selection change -}); - -// this will trigger the `selectionChangeEvent` with `{ source: CLEAR_SELECTION_STORAGE_SOURCE }` -storage.clearStorage({ imodelKey: imodel.key }); -``` diff --git a/packages/unified-selection/CHANGELOG.md b/packages/unified-selection/CHANGELOG.md index 60edf087f..a8069de79 100644 --- a/packages/unified-selection/CHANGELOG.md +++ b/packages/unified-selection/CHANGELOG.md @@ -1,5 +1,29 @@ # @itwin/unified-selection +## 1.8.0 + +### Minor Changes + +- [#1396](https://github.com/iTwin/presentation/pull/1396): Expose `CLEAR_SELECTION_STORAGE_SOURCE` constant that is used as selection change event source when selection storage is cleared. This should allow consumers to detect when selection change happened due to selection storage being cleared. + + ```ts + import { + createStorage, + CLEAR_SELECTION_STORAGE_SOURCE, + } from "@itwin/unified-selection"; + + const storage = createStorage(); + storage.selectionChangeEvent.addListener((args) => { + if (args.source === CLEAR_SELECTION_STORAGE_SOURCE) { + // ignore change if it was caused by clearing selection storage + } + // handle selection change + }); + + // this will trigger the `selectionChangeEvent` with `{ source: CLEAR_SELECTION_STORAGE_SOURCE }` + storage.clearStorage({ imodelKey: imodel.key }); + ``` + ## 1.7.6 ### Patch Changes diff --git a/packages/unified-selection/package.json b/packages/unified-selection/package.json index c8f30fd36..69fa8a5d4 100644 --- a/packages/unified-selection/package.json +++ b/packages/unified-selection/package.json @@ -1,6 +1,6 @@ { "name": "@itwin/unified-selection", - "version": "1.7.6", + "version": "1.8.0", "description": "Package for managing unified selection in iTwin.js applications.", "license": "MIT", "repository": {