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

This commit is contained in:
Alex Yang
2023-08-30 00:04:16 -05:00
committed by GitHub
parent 82f8ac50de
commit 00e7cf9a06
4 changed files with 40 additions and 8 deletions

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');