Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/sqlite_async/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.14.2-wip

- Web: fix uncaught error from `BroadcastUpdates` when a peer publishes a
message that does not deserialise into an `UpdateNotification`. The bare
`.cast()` after `.where()` is now typed explicitly, and a defensive
`onError` handler is attached to the broadcast subscription so malformed
peer payloads degrade silently instead of crashing the host application.

## 0.14.1

- Fix update notifications sometimes firing before a write has completed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ final class AsyncWebDatabaseImpl extends SqliteDatabaseImpl
_broadcastUpdatesSubscription =
broadcastUpdates.updates.listen((updates) {
updatesController.add(updates);
}, onError: (Object error, StackTrace stackTrace) {
// Cross-tab BroadcastChannel may deliver payloads that do not
// deserialise into an UpdateNotification (legacy storage mode,
// malformed peer messages, SharedWorker fallback). Drop them
// rather than crashing the host application via an uncaught
// error on the root zone.
Comment on lines +76 to +78
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BroadcastUpdates {
}
})
.where((e) => e != null)
.cast();
.cast<UpdateNotification>();
}

void send(UpdateNotification notification) {
Expand Down
2 changes: 1 addition & 1 deletion packages/sqlite_async/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sqlite_async
description: High-performance asynchronous interface for SQLite on Dart and Flutter.
version: 0.14.1
version: 0.14.2-wip
resolution: workspace
repository: https://github.com/powersync-ja/sqlite_async.dart
environment:
Expand Down
Loading