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(workspace): dont upgrade subdoc on cloud (#5382)

EYHNaa74b0617cc7
diff --git a/packages/common/infra/src/blocksuite/migration/workspace.ts b/packages/common/infra/src/blocksuite/migration/workspace.ts
index b2fa335d75..0ba7564604 100644
--- a/packages/common/infra/src/blocksuite/migration/workspace.ts
+++ b/packages/common/infra/src/blocksuite/migration/workspace.ts
@@ -11,7 +11,8 @@ export enum MigrationPoint {
}
export function checkWorkspaceCompatibility(
- workspace: Workspace
+ workspace: Workspace,
+ isCloud: boolean
): MigrationPoint | null {
// check if there is any key starts with 'space:' on root doc
const spaceMetaObj = workspace.doc.share.get('space:meta') as
@@ -20,7 +21,9 @@ export function checkWorkspaceCompatibility(
const docKeys = Array.from(workspace.doc.share.keys());
const haveSpaceMeta = !!spaceMetaObj && spaceMetaObj.size > 0;
const haveLegacySpace = docKeys.some(key => key.startsWith('space:'));
- if (haveSpaceMeta || haveLegacySpace) {
+
+ // DON'T UPGRADE SUBDOC ON CLOUD
+ if (!isCloud && (haveSpaceMeta || haveLegacySpace)) {
return MigrationPoint.SubDoc;
}
diff --git a/packages/frontend/workspace/src/upgrade/index.ts b/packages/frontend/workspace/src/upgrade/index.ts
index 53e06a5dc7..48c7a14bc3 100644
--- a/packages/frontend/workspace/src/upgrade/index.ts
+++ b/packages/frontend/workspace/src/upgrade/index.ts
@@ -49,7 +49,8 @@ export class WorkspaceUpgradeController {
checkIfNeedUpgrade() {
const needUpgrade = !!checkWorkspaceCompatibility(
- this.workspace.blockSuiteWorkspace
+ this.workspace.blockSuiteWorkspace,
+ this.workspace.flavour === WorkspaceFlavour.AFFINE_CLOUD
);
this.status = {
...this.status,
@@ -69,7 +70,8 @@ export class WorkspaceUpgradeController {
await this.workspace.engine.sync.waitForSynced();
const step = checkWorkspaceCompatibility(
- this.workspace.blockSuiteWorkspace
+ this.workspace.blockSuiteWorkspace,
+ this.workspace.flavour === WorkspaceFlavour.AFFINE_CLOUD
);
if (!step) {