diff --git a/.changeset/fair-planes-walk.md b/.changeset/fair-planes-walk.md new file mode 100644 index 00000000..bcdd6acb --- /dev/null +++ b/.changeset/fair-planes-walk.md @@ -0,0 +1,6 @@ +--- +'@journeyapps/powersync-sdk-react-native': patch +'@journeyapps/powersync-sdk-common': patch +--- + +Use default timeout in post streaming warning message. Update connectivity status on streaming messages. diff --git a/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts b/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts index f2e8df6c..cba9eff4 100644 --- a/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +++ b/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts @@ -54,10 +54,13 @@ export abstract class AbstractStreamingSyncImplementation extends BaseObserver(lockOptions: LockOptions): Promise; async hasCompletedSync() { @@ -163,6 +170,9 @@ export abstract class AbstractStreamingSyncImplementation extends BaseObserver(bucketSet); @@ -289,7 +299,13 @@ export abstract class AbstractStreamingSyncImplementation extends BaseObserver [this._isConnected, this._lastSyncedAt?.valueOf()]; + + const previousValues = takeSnapShot(); this._lastSyncedAt = lastSyncedAt ?? this.lastSyncedAt; - this.iterateListeners((cb) => cb.statusChanged?.(new SyncStatus(connected, this.lastSyncedAt))); + this._isConnected = connected; + if (!_.isEqual(previousValues, takeSnapShot())) { + this.iterateListeners((cb) => cb.statusChanged?.(new SyncStatus(this.isConnected, this.lastSyncedAt))); + } } } diff --git a/packages/powersync-sdk-react-native/src/sync/stream/ReactNativeRemote.ts b/packages/powersync-sdk-react-native/src/sync/stream/ReactNativeRemote.ts index b7b73a3f..b57c110e 100644 --- a/packages/powersync-sdk-react-native/src/sync/stream/ReactNativeRemote.ts +++ b/packages/powersync-sdk-react-native/src/sync/stream/ReactNativeRemote.ts @@ -65,7 +65,9 @@ export class ReactNativeRemote extends AbstractRemote { Platform.OS == 'android' ? setTimeout(() => { this.logger.warn( - `HTTP Streaming POST is taking longer than 30 seconds to resolve. If using a debug build, please ensure Flipper Network plugin is disabled.` + `HTTP Streaming POST is taking longer than ${Math.ceil( + STREAMING_POST_TIMEOUT_MS / 1000 + )} seconds to resolve. If using a debug build, please ensure Flipper Network plugin is disabled.` ); }, STREAMING_POST_TIMEOUT_MS) : null;