Skip to content

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: db7d0d3

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.

@simolus3 simolus3 merged commit cfee1d4 into main Mar 17, 2025
6 checks passed
@simolus3 simolus3 deleted the bucket-priorities-in-yjs branch March 17, 2025 14:50
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.

3 participants