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
  */
@@ -15260,6 +15260,16 @@ class DockviewComponent extends BaseGrid {
15260
15260
  }
15261
15261
  fromJSON(data, options) {
15262
15262
  var _a, _b, _c;
15263
+ // Cancel any popout-restoration timers queued by a previous fromJSON
15264
+ // that haven't fired yet. Each cleanup also disposes the orphan group
15265
+ // that was registered in _groups synchronously but never parented
15266
+ // into a popout window — otherwise the upcoming clear() would call
15267
+ // gridview.remove() on an unparented element and throw
15268
+ // "Invalid grid element". See issue #1304.
15269
+ for (const cleanup of [...this._popoutRestorationCleanups]) {
15270
+ cleanup();
15271
+ }
15272
+ this._popoutRestorationCleanups.clear();
15263
15273
  const existingPanels = new Map();
15264
15274
  let tempGroup;
15265
15275
  if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
@@ -15450,6 +15460,23 @@ class DockviewComponent extends BaseGrid {
15450
15460
  const cleanup = () => {
15451
15461
  this._popoutRestorationCleanups.delete(cleanup);
15452
15462
  clearTimeout(handle);
15463
+ // The group was registered in _groups synchronously
15464
+ // but the timer that would parent it into the popout
15465
+ // window never ran. Dispose the orphan here so the
15466
+ // next clear() doesn't trip over an unparented
15467
+ // element. See issue #1304.
15468
+ if (!this.isDisposed &&
15469
+ this._groups.has(group.id) &&
15470
+ group.element.parentElement === null) {
15471
+ for (const panel of [...group.panels]) {
15472
+ this.removePanel(panel, {
15473
+ removeEmptyGroup: false,
15474
+ });
15475
+ }
15476
+ group.dispose();
15477
+ this._groups.delete(group.id);
15478
+ this._onDidRemoveGroup.fire(group);
15479
+ }
15453
15480
  resolve();
15454
15481
  };
15455
15482
  const handle = setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-core",
3
- "version": "6.6.0",
3
+ "version": "6.6.1",
4
4
  "description": "Zero dependency layout manager supporting tabs, groups, grids and splitviews for vanilla TypeScript",
5
5
  "keywords": [
6
6
  "splitview",