Skip to content

Commit 0921202

Browse files
author
Benjamin Pasero
committed
web - do not loose state on unload
1 parent 1279264 commit 0921202

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/vs/platform/storage/browser/storageService.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ export class BrowserStorageService extends Disposable implements IStorageService
144144
// Signal as event so that clients can still store data
145145
this._onWillSaveState.fire({ reason: WillSaveStateReason.SHUTDOWN });
146146

147-
// Close DBs
148-
this.globalStorage.close();
149-
this.workspaceStorage.close();
147+
// We explicitly do not close our DBs because writing data onBeforeUnload()
148+
// can result in unexpected results. Namely, it seems that - even though this
149+
// operation is async - sometimes it is being triggered on unload and
150+
// succeeds. Often though, the DBs turn out to be empty because the write
151+
// never had a chance to complete.
150152
}
151153
}

0 commit comments

Comments
 (0)