Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt bucket priorities in yjs demo #512

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

simolus3
Copy link
Contributor

This adopts bucket priorities in the yjs demo, where the effect of buckets with priority: 0 is most obvious. In particular, this:

  1. Splits the global buckets into one bucket for documents (with the default priority) and one for document updates (with priority 0).
  2. Adds a small switch to the editor to disable uploading local changes (useful to build up a queue of local crud entries that would prevent sync operations from the server without priority 0).

Running the demo with updated sync rules requires a self-hosted sync service for bucket priorities to be supported. The effect of priority 0 can easily be seen by:

  1. Opening the same document in two browsers.
  2. Disabling local uploads in browser A, and making a few changes in that browser.
  3. Starting to type in browser B.

Despite of the local crud queue in A, changes from B are synchronized and made visible :)

Copy link

changeset-bot bot commented Feb 25, 2025

⚠️ No Changeset found

Latest commit: d62d1e7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@simolus3 simolus3 requested a review from rkistner February 25, 2025 16:34
Copy link
Contributor

@rkistner rkistner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Works much better now.

I updated the demo to use Supabase anonymous sign-ins, instead of custom auth Edge functions. This simplifies the setup quite a bit. I also removed some unused dependencies.

I wanted to remove the RPC function used for updates, instead just using Postgrest batch insert support. Unfortunately, doing base64 -> bytea conversion with Postgrest becomes complicated. I almost had it working using custom domains, but the PowerSync service does not handle those correctly for syncing down yet.

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