Skip to content

Commit

Permalink
fix: save document after loaded from json
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Onnikov <[email protected]>
  • Loading branch information
aonnikov committed Oct 28, 2024
1 parent e4e44dd commit 6955244
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/collaborator/src/storage/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ export class PlatformStorageAdapter implements CollabStorageAdapter {
})
})
if (markup !== undefined) {
return markupToYDocNoSchema(markup, documentId.objectAttr)
const ydoc = markupToYDocNoSchema(markup, documentId.objectAttr)

// if document was loaded from the initial content or storage we need to save
// it to ensure the next time we load it from the ydoc document
saveCollabYdoc(ctx, this.storage, workspaceId, documentId, ydoc)

return ydoc
}
} catch (err) {
ctx.error('failed to load initial document content', { documentName, content, error: err })
Expand Down

0 comments on commit 6955244

Please sign in to comment.