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