fix(core): blockVersions check (#4073)

This commit is contained in:
Alex Yang
2023-08-31 08:07:21 -05:00
committed by GitHub
parent 3f5e649295
commit f21426d23d

View File

@@ -140,11 +140,14 @@ export const WorkspaceLayoutInner = ({ children }: PropsWithChildren) => {
// this is a mistake in the // this is a mistake in the
// 0.8.0 ~ 0.8.1 // 0.8.0 ~ 0.8.1
// 0.8.0-beta.0 ~ 0.8.0-beta.3 // 0.8.0-beta.0 ~ 0.8.0-beta.3
// 0.9.0-canary.0 ~ 0.9.0-canary.3 // 0.8.0-canary.17 ~ 0.9.0-canary.3
const meta = currentWorkspace.blockSuiteWorkspace.doc.getMap('meta'); const meta = currentWorkspace.blockSuiteWorkspace.doc.getMap('meta');
const blockVersions = meta.get('blockVersions'); const blockVersions = meta.get('blockVersions');
if (!(blockVersions instanceof YMap)) { if (
console.log('fixing blockVersions'); !(blockVersions instanceof YMap) &&
blockVersions != null &&
typeof blockVersions === 'object'
) {
meta.set( meta.set(
'blockVersions', 'blockVersions',
new YMap(Object.entries(blockVersions as Record<string, number>)) new YMap(Object.entries(blockVersions as Record<string, number>))