Skip to content

Conversation

@rjwebb
Copy link
Contributor

@rjwebb rjwebb commented Jan 21, 2025

This PR adds support for the y.js Doc CRDT to Canvas.

The document update currently has to be computed outside of the action call.

To do:

  • Add a new "yjs-doc" column type to the model schema, models that have this column type can only have an id and content column, the content column stores a serialized Y.js document
  • Add a applyDocumentUpdate method which applies a Y.js update to a given document
  • Create a test that shows that document updates converge on concurrent peers
  • Remove the operations table?
  • The updates look a lot like continuations, could we make the API even simpler here?
  • Remove yjs from GossipLog, feels like we are leaking an abstraction here

Tests

  • Create a table with a yjs-doc column
  • Call one YJS method and assert that the operation has been added and the state has been updated
  • Call multiple YJS methods and assert that the operations have been added and the state has been updated
  • Sync two peers that have changes applied to YJS text tables and assert that the changes have been merged

How has this been tested?

  • CI tests pass
  • Tested with example-chat (including login, all signers, and exchanging messages)
  • Tested with @canvas-js/test-network: (optional)

Does this contain any breaking changes to external interfaces?

  • Contract interfaces
  • Core interface
  • CLI
  • Data storage formats, including IndexedDB, SQLite, or filesystem storage (will this break existing apps?)

@raykyri raykyri mentioned this pull request Mar 17, 2025
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants