Skip to content

Fix multi-tab sync issues #206

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

Merged
merged 3 commits into from
Nov 4, 2024
Merged

Fix multi-tab sync issues #206

merged 3 commits into from
Nov 4, 2024

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Nov 4, 2024

  1. Fix client parameters not being passed to the server (regression from Feat: Web sync worker #200).
  2. Reconnect when a client calls connect() again with different parameters.
  3. Immediately disconnect when any client calls disconnect() (or disconnectAndClear()).

(2) is to make sure we connect with the latest client parameters. I'm not sure if it's perhaps better to always reconnect when calling connect() - that's what we do in other SDKs (including native Flutter). However, that may not be optimal when working with multiple tabs, since it would effectively reconnect every time you open a new tab.

The last one is specifically an issue when calling disconnectAndClear(). If other tabs were open, the connection would remain open, despite deleting all data in the database. This caused the app to end up in a weird state.

@stevensJourney
Copy link
Contributor

FWIW We currently reconnect on every call to connect in the JS Web SDK, that does cause a reconnect whenever a new tab is opened.

@rkistner rkistner merged commit 1987882 into main Nov 4, 2024
4 checks passed
@rkistner rkistner deleted the fix-web-sync-parameters branch April 22, 2025 16:11
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