@ricsam/react-spreadsheets 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/react-spreadsheets",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "type": "commonjs"
5
5
  }
package/dist/mjs/lib.mjs CHANGED
@@ -3370,13 +3370,21 @@ class WorkbookSelectionManager {
3370
3370
  if (cachedSelections && manager.getState().selections.length === 0) {
3371
3371
  manager.replaceSelections(cachedSelections);
3372
3372
  }
3373
+ let previousFocus = manager.getState().hasFocus;
3374
+ let previousSelections = JSON.stringify(manager.getState().selections);
3373
3375
  const focusCleanup = manager.observeStateChange((state) => state.hasFocus, (hasFocus) => {
3376
+ if (hasFocus === previousFocus)
3377
+ return;
3378
+ previousFocus = hasFocus;
3374
3379
  if (hasFocus && !this.applyingRangeFocus.has(manager)) {
3375
3380
  this.rememberSelections(manager, registeredContext);
3376
3381
  this.emitChange();
3377
3382
  }
3378
3383
  });
3379
3384
  const selectionCleanup = manager.observeStateChange((state) => JSON.stringify(state.selections), (selectionsJson) => {
3385
+ if (selectionsJson === previousSelections)
3386
+ return;
3387
+ previousSelections = selectionsJson;
3380
3388
  if (this.applyingRangeFocus.has(manager))
3381
3389
  return;
3382
3390
  const selections = JSON.parse(selectionsJson);
@@ -4563,4 +4571,4 @@ export {
4563
4571
  useResizeObserver
4564
4572
  };
4565
4573
 
4566
- //# debugId=FA27216279C90A7964756E2164756E21
4574
+ //# debugId=A4984B6C177B85D364756E2164756E21