mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-28 11:53:24 +03:00
Merge branch 'master' into bugfix/upload-blob
This commit is contained in:
commit
081bf2cc25
@ -1,8 +1,10 @@
|
||||
import { createStore, keys, setMany, getMany, clear } from 'idb-keyval';
|
||||
import * as idb from 'lib0/indexeddb.js';
|
||||
|
||||
type IDBInstance<T = ArrayBufferLike> = {
|
||||
keys: () => Promise<string[]>;
|
||||
clear: () => Promise<void>;
|
||||
deleteDB: () => Promise<void>;
|
||||
setMany: (entries: [string, T][]) => Promise<void>;
|
||||
getMany: (keys: string[]) => Promise<T[]>;
|
||||
};
|
||||
@ -16,6 +18,7 @@ export function getDatabase<T = ArrayBufferLike>(
|
||||
return {
|
||||
keys: () => keys(db),
|
||||
clear: () => clear(db),
|
||||
deleteDB: () => idb.deleteDB(name),
|
||||
setMany: entries => setMany(entries, db),
|
||||
getMany: keys => getMany(keys, db),
|
||||
};
|
||||
|
@ -82,6 +82,7 @@ export const migrateBlobDB = async (
|
||||
return [id, { id, blob }] as [string, PendingTask];
|
||||
});
|
||||
await newPendingDB.setMany(pendingEntries);
|
||||
oldDB.clear();
|
||||
oldPendingDB.clear();
|
||||
|
||||
await oldDB.clear();
|
||||
await oldPendingDB.clear();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user