Yjs Electric provider example
This an example of a y-provider based on Electric.
The code is based on y-webscocket and the yjs-demos/codemirror.next
- [x] Awareness and broadcast across tabs
- [x] IDB persistence
- [x] Resume shape from last offset
- [x] Broadcast changes between tabs
- [x] Electric theme was replaced with bare minimum style (happy to revert)
- [x] Experimental compaction of YDoc
Deploy Preview for electric-next ready!
| Name | Link |
|---|---|
| Latest commit | 551382bd6015acecc1b01211524f8fa6f56f75e2 |
| Latest deploy log | https://app.netlify.com/sites/electric-next/deploys/66bb8f6879b9280008498879 |
| Deploy Preview | https://deploy-preview-1508--electric-next.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Deploy Preview for electric-next ready!
| Name | Link |
|---|---|
| Latest commit | 88b49207d665565fd79117ea36afb1b93411f38b |
| Latest deploy log | https://app.netlify.com/sites/electric-next/deploys/6756ec62ef7a4500089e7a32 |
| Deploy Preview | https://deploy-preview-1508--electric-next.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Experimental compaction of YDoc I've implemented compaction on the server by creating a new Ydoc, truncating the table and storing the new Ydoc. The truncation causes a shape rotation that will essentially clear the shape and start fresh from the Ydoc checkpoint.
This obviously isn't a complete implementation as the TRUNCATE also deletes all other Ydocs that we might be storing :D. The idea was to demonstrate the use of shape rotation to clear the log of operations. We should think if we want to expose the delete shape endpoint on the backend or not. The proxy could disallow any requests coming from the user.
EDIT: reflecting a bit more, maybe the best is to leave this out because we'll be able to do compaction a lot better in the future.