dockview-core 6.5.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.5.0
3
+ * @version 6.6.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -15266,6 +15266,16 @@
15266
15266
  }
15267
15267
  fromJSON(data, options) {
15268
15268
  var _a, _b, _c;
15269
+ // Cancel any popout-restoration timers queued by a previous fromJSON
15270
+ // that haven't fired yet. Each cleanup also disposes the orphan group
15271
+ // that was registered in _groups synchronously but never parented
15272
+ // into a popout window — otherwise the upcoming clear() would call
15273
+ // gridview.remove() on an unparented element and throw
15274
+ // "Invalid grid element". See issue #1304.
15275
+ for (const cleanup of [...this._popoutRestorationCleanups]) {
15276
+ cleanup();
15277
+ }
15278
+ this._popoutRestorationCleanups.clear();
15269
15279
  const existingPanels = new Map();
15270
15280
  let tempGroup;
15271
15281
  if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
@@ -15456,6 +15466,23 @@
15456
15466
  const cleanup = () => {
15457
15467
  this._popoutRestorationCleanups.delete(cleanup);
15458
15468
  clearTimeout(handle);
15469
+ // The group was registered in _groups synchronously
15470
+ // but the timer that would parent it into the popout
15471
+ // window never ran. Dispose the orphan here so the
15472
+ // next clear() doesn't trip over an unparented
15473
+ // element. See issue #1304.
15474
+ if (!this.isDisposed &&
15475
+ this._groups.has(group.id) &&
15476
+ group.element.parentElement === null) {
15477
+ for (const panel of [...group.panels]) {
15478
+ this.removePanel(panel, {
15479
+ removeEmptyGroup: false,
15480
+ });
15481
+ }
15482
+ group.dispose();
15483
+ this._groups.delete(group.id);
15484
+ this._onDidRemoveGroup.fire(group);
15485
+ }
15459
15486
  resolve();
15460
15487
  };
15461
15488
  const handle = setTimeout(() => {
@@ -1140,6 +1140,16 @@ export class DockviewComponent extends BaseGrid {
1140
1140
  }
1141
1141
  fromJSON(data, options) {
1142
1142
  var _a, _b, _c;
1143
+ // Cancel any popout-restoration timers queued by a previous fromJSON
1144
+ // that haven't fired yet. Each cleanup also disposes the orphan group
1145
+ // that was registered in _groups synchronously but never parented
1146
+ // into a popout window — otherwise the upcoming clear() would call
1147
+ // gridview.remove() on an unparented element and throw
1148
+ // "Invalid grid element". See issue #1304.
1149
+ for (const cleanup of [...this._popoutRestorationCleanups]) {
1150
+ cleanup();
1151
+ }
1152
+ this._popoutRestorationCleanups.clear();
1143
1153
  const existingPanels = new Map();
1144
1154
  let tempGroup;
1145
1155
  if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
@@ -1330,6 +1340,23 @@ export class DockviewComponent extends BaseGrid {
1330
1340
  const cleanup = () => {
1331
1341
  this._popoutRestorationCleanups.delete(cleanup);
1332
1342
  clearTimeout(handle);
1343
+ // The group was registered in _groups synchronously
1344
+ // but the timer that would parent it into the popout
1345
+ // window never ran. Dispose the orphan here so the
1346
+ // next clear() doesn't trip over an unparented
1347
+ // element. See issue #1304.
1348
+ if (!this.isDisposed &&
1349
+ this._groups.has(group.id) &&
1350
+ group.element.parentElement === null) {
1351
+ for (const panel of [...group.panels]) {
1352
+ this.removePanel(panel, {
1353
+ removeEmptyGroup: false,
1354
+ });
1355
+ }
1356
+ group.dispose();
1357
+ this._groups.delete(group.id);
1358
+ this._onDidRemoveGroup.fire(group);
1359
+ }
1333
1360
  resolve();
1334
1361
  };
1335
1362
  const handle = setTimeout(() => {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 6.5.0
3
+ * @version 6.6.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -15262,6 +15262,16 @@ class DockviewComponent extends BaseGrid {
15262
15262
  }
15263
15263
  fromJSON(data, options) {
15264
15264
  var _a, _b, _c;
15265
+ // Cancel any popout-restoration timers queued by a previous fromJSON
15266
+ // that haven't fired yet. Each cleanup also disposes the orphan group
15267
+ // that was registered in _groups synchronously but never parented
15268
+ // into a popout window — otherwise the upcoming clear() would call
15269
+ // gridview.remove() on an unparented element and throw
15270
+ // "Invalid grid element". See issue #1304.
15271
+ for (const cleanup of [...this._popoutRestorationCleanups]) {
15272
+ cleanup();
15273
+ }
15274
+ this._popoutRestorationCleanups.clear();
15265
15275
  const existingPanels = new Map();
15266
15276
  let tempGroup;
15267
15277
  if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {
@@ -15452,6 +15462,23 @@ class DockviewComponent extends BaseGrid {
15452
15462
  const cleanup = () => {
15453
15463
  this._popoutRestorationCleanups.delete(cleanup);
15454
15464
  clearTimeout(handle);
15465
+ // The group was registered in _groups synchronously
15466
+ // but the timer that would parent it into the popout
15467
+ // window never ran. Dispose the orphan here so the
15468
+ // next clear() doesn't trip over an unparented
15469
+ // element. See issue #1304.
15470
+ if (!this.isDisposed &&
15471
+ this._groups.has(group.id) &&
15472
+ group.element.parentElement === null) {
15473
+ for (const panel of [...group.panels]) {
15474
+ this.removePanel(panel, {
15475
+ removeEmptyGroup: false,
15476
+ });
15477
+ }
15478
+ group.dispose();
15479
+ this._groups.delete(group.id);
15480
+ this._onDidRemoveGroup.fire(group);
15481
+ }
15455
15482
  resolve();
15456
15483
  };
15457
15484
  const handle = setTimeout(() => {