feat: bump blocksuite and fix bug in migration (#4653)

Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
Flrande
2023-10-18 22:45:07 +08:00
committed by GitHub
parent 63ca9671be
commit 814d552be8
18 changed files with 438 additions and 169 deletions

View File

@@ -62,12 +62,12 @@
"uuid": "^9.0.1"
},
"devDependencies": {
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/editor": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/global": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/icons": "2.1.34",
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/lit": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/store": "0.0.0-20231018100009-361737d3-nightly",
"@storybook/jest": "^0.2.3",
"@storybook/testing-library": "^0.2.2",
"@testing-library/react": "^14.0.0",

View File

@@ -5,8 +5,8 @@
"main": "./src/index.ts",
"module": "./src/index.ts",
"devDependencies": {
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/store": "0.0.0-20231018100009-361737d3-nightly",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "0.34.6",

View File

@@ -14,12 +14,12 @@
},
"devDependencies": {
"@affine/env": "workspace:*",
"@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/block-std": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/blocks": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/editor": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/global": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/lit": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/store": "0.0.0-20231018100009-361737d3-nightly",
"@testing-library/react": "^14.0.0",
"@types/lodash.debounce": "^4.0.7",
"fake-indexeddb": "^5.0.0",

View File

@@ -55,9 +55,9 @@
},
"dependencies": {
"@affine/sdk": "workspace:*",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/global": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/store": "0.0.0-20231018100009-361737d3-nightly",
"jotai": "^2.4.3",
"jotai-effect": "^0.1.0",
"tinykeys": "^2.1.0",
@@ -66,8 +66,8 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/editor": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/lit": "0.0.0-20231018100009-361737d3-nightly",
"@testing-library/react": "^14.0.0",
"async-call-rpc": "^6.3.1",
"electron": "link:../../apps/electron/node_modules/electron",

View File

@@ -261,6 +261,25 @@ export async function buildShowcaseWorkspace(
.catch(error => {
console.error('error importing page', id, error);
});
const page = workspace.getPage(newId);
assertExists(page);
await page.waitForLoaded();
workspace.schema.upgradePage(
0,
{
'affine:note': 1,
'affine:bookmark': 1,
'affine:database': 2,
'affine:divider': 1,
'affine:image': 1,
'affine:list': 1,
'affine:code': 1,
'affine:page': 2,
'affine:paragraph': 1,
'affine:surface': 3,
},
page.spaceDoc
);
})
);
Object.entries(pageMetas).forEach(([oldId, meta]) => {
@@ -273,6 +292,7 @@ import { applyUpdate, encodeStateAsUpdate } from 'yjs';
const migrationOrigin = 'affine-migration';
import { assertExists } from '@blocksuite/global/utils';
import type { Schema } from '@blocksuite/store';
import { nanoid } from 'nanoid';
@@ -584,7 +604,7 @@ export async function forceUpgradePages(
const oldVersions = versions.toJSON();
spaces.forEach((space: Doc) => {
try {
schema.upgradePage(oldVersions, space);
schema.upgradePage(0, oldVersions, space);
} catch (e) {
console.error(`page ${space.guid} upgrade failed`, e);
}
@@ -605,6 +625,7 @@ async function upgradeV2ToV3(options: UpgradeOptions): Promise<boolean> {
const schema = options.getSchema();
spaces.forEach((space: Doc) => {
schema.upgradePage(
0,
{
'affine:note': 1,
'affine:bookmark': 1,

View File

@@ -22,11 +22,11 @@
"dist"
],
"dependencies": {
"@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/block-std": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/blocks": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/editor": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/global": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/store": "0.0.0-20231018100009-361737d3-nightly",
"jotai": "^2.4.3",
"zod": "^3.22.4"
},

View File

@@ -37,8 +37,8 @@
"y-provider": "workspace:*"
},
"devDependencies": {
"@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/blocks": "0.0.0-20231018100009-361737d3-nightly",
"@blocksuite/store": "0.0.0-20231018100009-361737d3-nightly",
"fake-indexeddb": "^5.0.0",
"vite": "^4.4.11",
"vite-plugin-dts": "3.6.0",

View File

@@ -24,7 +24,7 @@
"build": "vite build"
},
"devDependencies": {
"@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly",
"@blocksuite/store": "0.0.0-20231018100009-361737d3-nightly",
"vite": "^4.4.11",
"vite-plugin-dts": "3.6.0",
"vitest": "0.34.6",