codepod-io / codepod

Codepod IDE: Scalable Interactive Coding
https://codepod.io
MIT License
74 stars 15 forks source link

feat: use yjs as the source-of-truth #440

Closed lihebi closed 1 year ago

lihebi commented 1 year ago

This is a major change. Close #331

Before

Previous architecture (detailed in #205) is centered around the browser (yjs <-> browser <-> DB), which is problematic because:

  1. we have two (potential inconsistent) sources of data (yjs and DB)
  2. there can be multiple users/browsers. It's complex to decide which user/browser should push to DB

After

Now we are changing to Yjs-centered (browser <-> Yjs <-> DB). Yjs is the single source-of-truth.

Details

This PR removes a lot of syncing logic/functions from front-end, notably those addPod, loadRepo, setPodGeo reducers.

TODOs:

lihebi commented 1 year ago

This feature is roughly usable. I'm merging this so that people can work on top of this, and avoid merge conflicts, as this PR is too large and touches everything.

Remaining problems: state.pods is now empty. So the following things break and need fixes in the follow-up PRs:

lihebi commented 1 year ago

Note: DB schema changed. You need to apply the migration and recreate your docker stack.