feat: seperate createDoc and createStore (#11182)

This commit is contained in:
Saul-Mirone
2025-03-26 11:03:47 +00:00
parent d6093e1d66
commit 0a8d8e0a6b
70 changed files with 337 additions and 312 deletions

View File

@@ -15,8 +15,8 @@ export async function importFromSnapshot(
schema: new Schema().register(AffineSchemas),
blobCRUD: collection.blobSync,
docCRUD: {
create: (id: string) => collection.createDoc({ id }),
get: (id: string) => collection.getDoc(id),
create: (id: string) => collection.createDoc(id).getStore({ id }),
get: (id: string) => collection.getDoc(id)?.getStore({ id }) ?? null,
delete: (id: string) => collection.removeDoc(id),
},
middlewares: [replaceIdMiddleware(collection.idGenerator)],

View File

@@ -50,7 +50,7 @@ function createCollectionOptions() {
}
function initCollection(collection: TestWorkspace) {
const doc = collection.createDoc({ id: 'doc:home' });
const doc = collection.createDoc('doc:home').getStore();
doc.load(() => {
const rootId = doc.addBlock('affine:page', {