mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 16:46:22 +08:00
fix: init workspace logic (#1471)
This commit is contained in:
@@ -56,13 +56,16 @@ const createIndexedDBProvider = (
|
||||
blockSuiteWorkspace: BlockSuiteWorkspace
|
||||
): LocalIndexedDBProvider => {
|
||||
let indexeddbProvider: IndexeddbPersistence | null = null;
|
||||
const callbacks = new Set<() => void>();
|
||||
return {
|
||||
flavour: 'local-indexeddb',
|
||||
callbacks,
|
||||
// fixme: remove background long polling
|
||||
background: true,
|
||||
cleanup: () => {
|
||||
assertExists(indexeddbProvider);
|
||||
indexeddbProvider.clearData();
|
||||
callbacks.clear();
|
||||
indexeddbProvider = null;
|
||||
},
|
||||
connect: () => {
|
||||
@@ -71,6 +74,9 @@ const createIndexedDBProvider = (
|
||||
blockSuiteWorkspace.id,
|
||||
blockSuiteWorkspace.doc
|
||||
);
|
||||
indexeddbProvider.whenSynced.then(() => {
|
||||
callbacks.forEach(cb => cb());
|
||||
});
|
||||
},
|
||||
disconnect: () => {
|
||||
assertExists(indexeddbProvider);
|
||||
|
||||
Reference in New Issue
Block a user