@tutti-os/workbench-surface 0.0.102 → 0.0.103

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.
package/dist/index.js CHANGED
@@ -6742,6 +6742,8 @@ var WorkbenchHostSessionController = class {
6742
6742
  readyPromise;
6743
6743
  resolveReady = noop;
6744
6744
  saveTimer = null;
6745
+ appliedSaveSequence = 0;
6746
+ saveSequence = 0;
6745
6747
  externalStateUnsubscribe = null;
6746
6748
  leaseUnsubscribe = null;
6747
6749
  unsubscribe = null;
@@ -7371,6 +7373,7 @@ var WorkbenchHostSessionController = class {
7371
7373
  if (!this.isSnapshotLoaded) {
7372
7374
  return;
7373
7375
  }
7376
+ const generation = this.loadGeneration;
7374
7377
  const snapshot = sanitizeWorkbenchHostSnapshot(
7375
7378
  createWorkbenchSnapshotFromState(
7376
7379
  this.applyExternalSnapshotNodeState(
@@ -7395,10 +7398,21 @@ var WorkbenchHostSessionController = class {
7395
7398
  if (workbenchSnapshotSaveKey(snapshot) === this.loadedSnapshotSaveKey()) {
7396
7399
  return;
7397
7400
  }
7398
- void Promise.resolve(
7399
- this.input.snapshotRepository.save(this.input.workspaceId, snapshot)
7400
- ).then((savedSnapshot) => {
7401
- this.loadedSnapshot = savedSnapshot;
7401
+ let saveResult;
7402
+ try {
7403
+ saveResult = this.input.snapshotRepository.save(
7404
+ this.input.workspaceId,
7405
+ snapshot
7406
+ );
7407
+ } catch {
7408
+ return;
7409
+ }
7410
+ const saveSequence = ++this.saveSequence;
7411
+ void Promise.resolve(saveResult).then((savedSnapshot) => {
7412
+ if (!this.isDisposed && generation === this.loadGeneration && saveSequence > this.appliedSaveSequence) {
7413
+ this.appliedSaveSequence = saveSequence;
7414
+ this.loadedSnapshot = savedSnapshot;
7415
+ }
7402
7416
  }, noop);
7403
7417
  }
7404
7418
  rememberClosedDockWindowFrame(nodeId) {