Skip to content

Commit 897cc30

Browse files
author
joshuabrink
committed
chore: clean up comments
1 parent 6f5e44d commit 897cc30

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

.changeset/brave-otters-listen.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
'@powersync/shared-internals': patch
33
---
44

5-
Fix sync stream subscription changes being lost when they happen while `connect()` is still creating the sync
6-
implementation. A `subscribe()` or `unsubscribe()` in that window was silently dropped and never retried, leaving a
7-
stream syncing after nothing was subscribed to it, or a stream that the client reports as subscribed but which is never
8-
requested (so no data arrives and `waitForFirstSync()` never resolves).
5+
Fix stream subscription changes made while `connect()` is still bringing up the sync implementation being
6+
lost until the next reconnect. A stream could keep syncing after being unsubscribed, or be reported as
7+
subscribed while never being requested, leaving `waitForFirstSync()` unresolved.

packages/shared-internals/src/client/ConnectionManager.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,6 @@ export class ConnectionManager extends BaseObserver<ConnectionManagerListener> {
234234

235235
this.pendingConnectionOptions = null;
236236

237-
// An update from subscriptionsMayHaveChanged() is lost between this read and the
238-
// implementation being ready: there is nothing to send it to yet, or it is sent to an
239-
// implementation that discards it. Compare against this and re-send the current set below.
240237
const subscriptionsAtStart = this.subscriptionIdentity;
241238
const { sync, onDispose } = await this.options.createSyncImplementation(connector, {
242239
subscriptions: this.activeStreams,
@@ -247,6 +244,7 @@ export class ConnectionManager extends BaseObserver<ConnectionManagerListener> {
247244
this.syncDisposer = onDispose;
248245
await this.syncStreamImplementation.waitForReady();
249246

247+
// Subscriptions changed while creating the sync stream implementation, update it now.
250248
if (this.subscriptionIdentity !== subscriptionsAtStart) {
251249
this.syncStreamImplementation.updateSubscriptions(this.activeStreams);
252250
}

0 commit comments

Comments
 (0)