fix(core): incorrect blocksuite data format (#4039)

This commit is contained in:
Alex Yang
2023-08-30 00:04:16 -05:00
parent 92714a588b
commit 448496c245
4 changed files with 40 additions and 8 deletions
+5 -3
View File
@@ -50,9 +50,11 @@ export const migrateToLatestDatabase = async (path: string) => {
const update = (
await connection.getUpdates(isRoot ? undefined : doc.guid)
).map(update => update.data);
// Buffer[] -> Uint8Array
const data = new Uint8Array(Buffer.concat(update).buffer);
applyUpdate(doc, data);
// Buffer[] -> Uint8Array[]
const data = update.map(update => new Uint8Array(update));
data.forEach(data => {
applyUpdate(doc, data);
});
// trigger data manually
if (isRoot) {
doc.getMap('meta');