Skip to content

Commit ba156e6

Browse files
texufrichvdh
andcommitted
Update storage interface so that save() is async to match indexeddb impl (matrix-org#3221)
The only implementation of this is an async function, but I can’t await it because the interface hides the return type. Co-authored-by: Richard van der Hoff <[email protected]>
1 parent 1342ea8 commit ba156e6

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/store/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export interface IStore {
176176
/**
177177
* Save does nothing as there is no backing data store.
178178
*/
179-
save(force?: boolean): void;
179+
save(force?: boolean): Promise<void>;
180180

181181
/**
182182
* Startup does nothing.

src/store/memory.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ export class MemoryStore implements IStore {
324324
* @param force - True to force a save (but the memory
325325
* store still can't save anything)
326326
*/
327-
public save(force: boolean): void {}
327+
public save(force: boolean): Promise<void> {
328+
return Promise.resolve();
329+
}
328330

329331
/**
330332
* Startup does nothing as this store doesn't require starting up.

src/store/stub.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ export class StubStore implements IStore {
189189
/**
190190
* Save does nothing as there is no backing data store.
191191
*/
192-
public save(): void {}
192+
public save(): Promise<void> {
193+
return Promise.resolve();
194+
}
193195

194196
/**
195197
* Startup does nothing.

src/sync.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ export class SyncApi {
953953
}
954954

955955
// tell databases that everything is now in a consistent state and can be saved.
956-
this.client.store.save();
956+
await this.client.store.save();
957957
}
958958
}
959959

0 commit comments

Comments
 (0)