Skip to content

Send sync status updates over broadcast channel when shared workers are disabled - #1047

Merged
simolus3 merged 6 commits into
mainfrom
broadcast-sync-status-updates
Jul 27, 2026
Merged

Send sync status updates over broadcast channel when shared workers are disabled#1047
simolus3 merged 6 commits into
mainfrom
broadcast-sync-status-updates

Conversation

@simolus3

Copy link
Copy Markdown
Contributor

To coordinate the sync process across tabs, we prefer to use shared workers. Shared workers are broken and disabled by default on Safari though, we also disable them on mobile. In these cases, each tab would attempt to sync on its own, with most tabs blocked on the navigator sync lock, leaving an app stuck waiting for hasSynced.

As a minor improvement, this makes the connected tab send its status update through a broadcast channel that other tabs trying to connect will listen to. So download progress and fields like hasSynced are then shared across tabs, and it appears like all tabs make sync progress similar to the setup with shared workers. Additionally, stream subscription changes from any tab are also broadcast to update the sync client in the active tab.

This solution is not perfect, being able to rely on shared workers would definitely be better. But it's still an improvement and provides limited multi-tab support even without shared workers.

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 583f493

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@powersync/shared-internals Minor
@powersync/web Minor
@powersync/adapter-sql-js Patch
@powersync/capacitor Patch
@powersync/node Patch
@powersync/react-native Patch
@powersync/diagnostics-app Patch

Not sure what this means? Click here to learn what changesets are.

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

@simolus3
simolus3 marked this pull request as ready for review July 27, 2026 13:04
@simolus3
simolus3 requested a review from Chriztiaan July 27, 2026 13:04
Comment thread .changeset/mighty-dodos-prove.md Outdated
@simolus3
simolus3 force-pushed the broadcast-sync-status-updates branch from 4cb53b2 to 32d08d8 Compare July 27, 2026 14:29
Chriztiaan
Chriztiaan previously approved these changes Jul 27, 2026
@simolus3
simolus3 merged commit bc50ecc into main Jul 27, 2026
16 of 18 checks passed
@simolus3
simolus3 deleted the broadcast-sync-status-updates branch July 27, 2026 15:45
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