Skip to content

Commit 4dc2727

Browse files
jeanp413bpasero
andauthored
Only update storage IS_NEW_KEY once (microsoft#154313)
* Fixes microsoft#153913 * spelling error Co-authored-by: Benjamin Pasero <[email protected]>
1 parent 9bb5a4c commit 4dc2727

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/vs/workbench/services/storage/browser/storageService.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class BrowserStorageService extends AbstractStorageService {
2323

2424
private applicationStorage: IStorage | undefined;
2525
private applicationStorageDatabase: IIndexedDBStorageDatabase | undefined;
26-
private readonly applicationStoragePromise = new DeferredPromise<{ indededDb: IIndexedDBStorageDatabase; storage: IStorage }>();
26+
private readonly applicationStoragePromise = new DeferredPromise<{ indexedDb: IIndexedDBStorageDatabase; storage: IStorage }>();
2727

2828
private profileStorage: IStorage | undefined;
2929
private profileStorageDatabase: IIndexedDBStorageDatabase | undefined;
@@ -92,7 +92,7 @@ export class BrowserStorageService extends AbstractStorageService {
9292

9393
this.updateIsNew(this.applicationStorage);
9494

95-
this.applicationStoragePromise.complete({ indededDb: applicationStorageIndexedDB, storage: this.applicationStorage });
95+
this.applicationStoragePromise.complete({ indexedDb: applicationStorageIndexedDB, storage: this.applicationStorage });
9696
}
9797

9898
private async createProfileStorage(profile: IUserDataProfile): Promise<void> {
@@ -110,22 +110,24 @@ export class BrowserStorageService extends AbstractStorageService {
110110
// avoid creating the storage library a second time on
111111
// the same DB.
112112

113-
const { indededDb: applicationStorageIndexedDB, storage: applicationStorage } = await this.applicationStoragePromise.p;
113+
const { indexedDb: applicationStorageIndexedDB, storage: applicationStorage } = await this.applicationStoragePromise.p;
114114

115115
this.profileStorageDatabase = applicationStorageIndexedDB;
116116
this.profileStorage = applicationStorage;
117+
118+
this.profileStorageDisposables.add(this.profileStorage.onDidChangeStorage(key => this.emitDidChangeValue(StorageScope.PROFILE, key)));
117119
} else {
118120
const profileStorageIndexedDB = await IndexedDBStorageDatabase.create({ id: this.getId(StorageScope.PROFILE), broadcastChanges: true }, this.logService);
119121

120122
this.profileStorageDatabase = this.profileStorageDisposables.add(profileStorageIndexedDB);
121123
this.profileStorage = this.profileStorageDisposables.add(new Storage(this.profileStorageDatabase));
122-
}
123124

124-
this.profileStorageDisposables.add(this.profileStorage.onDidChangeStorage(key => this.emitDidChangeValue(StorageScope.PROFILE, key)));
125+
this.profileStorageDisposables.add(this.profileStorage.onDidChangeStorage(key => this.emitDidChangeValue(StorageScope.PROFILE, key)));
125126

126-
await this.profileStorage.init();
127+
await this.profileStorage.init();
127128

128-
this.updateIsNew(this.profileStorage);
129+
this.updateIsNew(this.profileStorage);
130+
}
129131
}
130132

131133
private async createWorkspaceStorage(): Promise<void> {

0 commit comments

Comments
 (0)