Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): upload binary after migration (#4241)

Alex Yang075986b2e390
diff --git a/apps/core/src/components/migration-fallback.tsx b/apps/core/src/components/migration-fallback.tsx
index af8f047194..ee2863d873 100644
--- a/apps/core/src/components/migration-fallback.tsx
+++ b/apps/core/src/components/migration-fallback.tsx
@@ -83,6 +83,27 @@ export const MigrationFallback = function MigrationFallback() {
}
}
};
+ const uploadRecursively = async (doc: YDoc) => {
+ {
+ await localProvider.datasource.sendDocUpdate(
+ doc.guid,
+ encodeStateAsUpdate(doc)
+ );
+ console.log('upload indexeddb', doc.guid);
+ if (remoteProvider) {
+ await remoteProvider.datasource.sendDocUpdate(
+ doc.guid,
+ encodeStateAsUpdate(doc)
+ );
+ console.log('upload remote', doc.guid);
+ }
+ }
+ await Promise.all(
+ [...doc.subdocs].map(async subdoc => {
+ await uploadRecursively(subdoc);
+ })
+ );
+ };
await downloadRecursively(workspace.blockSuiteWorkspace.doc);
console.log('download done');
@@ -92,6 +113,7 @@ export const MigrationFallback = function MigrationFallback() {
getCurrentRootDoc: async () => workspace.blockSuiteWorkspace.doc,
getSchema: () => workspace.blockSuiteWorkspace.schema,
});
+ await uploadRecursively(workspace.blockSuiteWorkspace.doc);
console.log('migration done');
setDone(true);
}, [
diff --git a/tests/affine-cloud/e2e/basic.spec.ts b/tests/affine-cloud/e2e/basic.spec.ts
index f6c0c29f49..3c080593af 100644
--- a/tests/affine-cloud/e2e/basic.spec.ts
+++ b/tests/affine-cloud/e2e/basic.spec.ts
@@ -100,7 +100,8 @@ test.describe('basic', () => {
timeout: 60000,
});
await page.goto(
- `${coreUrl}/workspace/${workspaceId}/gc5FeppNDv-hello-world`
+ // page 'F1SX6cgNxy' has edgeless mode
+ `${coreUrl}/workspace/${workspaceId}/F1SX6cgNxy`
);
await waitForEditorLoad(page);
await clickEdgelessModeButton(page);