mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-23 00:55:37 +03:00
fix(y-indexeddb): migration for once (#1868)
This commit is contained in:
parent
c0669359ed
commit
a599364218
@ -238,7 +238,7 @@ export const createIndexedDBProvider = (
|
|||||||
doc.on('destroy', handleDestroy);
|
doc.on('destroy', handleDestroy);
|
||||||
// only run promise below, otherwise the logic is incorrect
|
// only run promise below, otherwise the logic is incorrect
|
||||||
const db = await dbPromise;
|
const db = await dbPromise;
|
||||||
if (!allDb) {
|
if (!allDb || localStorage.getItem(`${dbName}-migration`) !== 'true') {
|
||||||
allDb = await indexedDB.databases();
|
allDb = await indexedDB.databases();
|
||||||
// run the migration
|
// run the migration
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
@ -283,6 +283,7 @@ export const createIndexedDBProvider = (
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
localStorage.setItem(`${dbName}-migration`, 'true');
|
||||||
}
|
}
|
||||||
const store = db
|
const store = db
|
||||||
.transaction('workspace', 'readwrite')
|
.transaction('workspace', 'readwrite')
|
||||||
|
Loading…
Reference in New Issue
Block a user