dockview-core 6.6.0 → 6.6.1

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,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 6.6.0
3
+ * @version 6.6.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -15296,6 +15296,16 @@
15296
15296
  }
15297
15297
  fromJSON(data, options) {
15298
15298
  var _a, _b, _c;
15299
+ // Cancel any popout-restoration timers queued by a previous fromJSON
15300
+ // that haven't fired yet. Each cleanup also disposes the orphan group
15301
+ // that was registered in _groups synchronously but never parented
15302
+ // into a popout window — otherwise the upcoming clear() would call
15303
+ // gridview.remove() on an unparented element and throw
15304
+ // "Invalid grid element". See issue #1304.
15305
+ for (const cleanup of [...this._popoutRestorationCleanups]) {
15306
+ cleanup();
15307
+ }
15308
+ this._popoutRestorationCleanups.clear();
15299
15309
  const existingPanels = new Map();
15300
15310
  let tempGroup;
15301
15311
  if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
@@ -15486,6 +15496,23 @@
15486
15496
  const cleanup = () => {
15487
15497
  this._popoutRestorationCleanups.delete(cleanup);
15488
15498
  clearTimeout(handle);
15499
+ // The group was registered in _groups synchronously
15500
+ // but the timer that would parent it into the popout
15501
+ // window never ran. Dispose the orphan here so the
15502
+ // next clear() doesn't trip over an unparented
15503
+ // element. See issue #1304.
15504
+ if (!this.isDisposed &&
15505
+ this._groups.has(group.id) &&
15506
+ group.element.parentElement === null) {
15507
+ for (const panel of [...group.panels]) {
15508
+ this.removePanel(panel, {
15509
+ removeEmptyGroup: false,
15510
+ });
15511
+ }
15512
+ group.dispose();
15513
+ this._groups.delete(group.id);
15514
+ this._onDidRemoveGroup.fire(group);
15515
+ }
15489
15516
  resolve();
15490
15517
  };
15491
15518
  const handle = setTimeout(() => {