mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
refactor: remove y-indexeddb (#1771)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
"@affine/env": "workspace:*",
|
||||
"@blocksuite/blocks": "0.5.0-20230326033652-70ca43c",
|
||||
"@blocksuite/store": "0.5.0-20230326033652-70ca43c",
|
||||
"@toeverything/y-indexeddb": "workspace:*",
|
||||
"firebase": "^9.19.1",
|
||||
"jotai": "^2.0.3",
|
||||
"js-base64": "^3.7.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { nanoid, Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
|
||||
import { createIndexedDBProvider } from '@toeverything/y-indexeddb';
|
||||
import { createJSONStorage } from 'jotai/utils';
|
||||
import { IndexeddbPersistence } from 'y-indexeddb';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { createLocalProviders } from '../providers';
|
||||
@@ -47,9 +47,10 @@ export const CRUD: WorkspaceCRUD<WorkspaceFlavour.LOCAL> = {
|
||||
(_: string) => undefined
|
||||
);
|
||||
BlockSuiteWorkspace.Y.applyUpdateV2(blockSuiteWorkspace.doc, binary);
|
||||
const persistence = new IndexeddbPersistence(id, blockSuiteWorkspace.doc);
|
||||
const persistence = createIndexedDBProvider(id, blockSuiteWorkspace.doc);
|
||||
persistence.connect();
|
||||
await persistence.whenSynced.then(() => {
|
||||
persistence.destroy();
|
||||
persistence.disconnect();
|
||||
});
|
||||
storage.setItem(kStoreKey, [...data, id]);
|
||||
console.log('create', id, storage.getItem(kStoreKey));
|
||||
|
||||
Reference in New Issue
Block a user