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

Add RealtimeSyncOff and refactor interface of SyncMode #170

Merged
merged 6 commits into from
Apr 15, 2024
Merged

Conversation

7hong13
Copy link
Contributor

@7hong13 7hong13 commented Apr 15, 2024

What this PR does / why we need it?

The SyncOff mode will allow users to maintain the watch stream functionality while disabling synchronization.

- 1️⃣ With the addition of the `RealtimeSyncOff` mode, the `SyncMode` has been simplified into four options. Usage is as follows:

// as-is
await client.pause(doc); // manual sync
await client.resume(doc); // realtime sync(pushpull)
client.pauseRemoteChanges(doc); // pushonly 
client.resumeRemoteChanges(doc); // pushpull 

// to-be
await client.changeSyncMode(doc, SyncMode.Manual);
await client.changeSyncMode(doc, SyncMode.Realtime); // Same as PushPull mode
await client.changeSyncMode(doc, SyncMode.RealtimePushOnly); 
await client.changeSyncMode(doc, SyncMode.RealtimeSyncOff); // Added RealtimeSyncOff mode 

- 2️⃣ In manual sync mode, the `sync()` function can now only be executed in pushpull mode.

await client.sync(doc, SyncMode.PushOnly) // Deprecated: Only pushpull synchronization is supported now.

- 3️⃣ The option to specify manual sync during attachment has been updated.

// as-is 
await client.attach(doc, { isRealtimeSync: false });

// to-be
await client.attach(doc, { syncMode: SyncMode.Manual });

Any background context you want to provide?

What are the relevant tickets?

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@7hong13 7hong13 added the enhancement 🌟 New feature or request label Apr 15, 2024
@7hong13 7hong13 added this to the 0.4.16 milestone Apr 15, 2024
@7hong13 7hong13 self-assigned this Apr 15, 2024
@7hong13
Copy link
Contributor Author

7hong13 commented Apr 15, 2024

it seems like codecov keeps failing since it doesn't support tokenless uploading anymore.

(cc. @hackerwins )

@7hong13 7hong13 merged commit 95a2fee into main Apr 15, 2024
5 of 6 checks passed
@7hong13 7hong13 deleted the sync_mode branch April 15, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🌟 New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants