File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
packages/powersync_core/lib/src Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,20 @@ class BucketStorage {
5353 var count = 0 ;
5454
5555 await writeTransaction ((tx) async {
56+ final descriptions = [
57+ for (final MapEntry (: key, : value) in batch.descriptions.entries)
58+ {
59+ key: {'priority' : value.priority},
60+ }
61+ ];
62+
5663 for (var b in batch.buckets) {
5764 count += b.data.length;
5865 await _updateBucket2 (
5966 tx,
6067 jsonEncode ({
61- 'buckets' : [b]
68+ 'buckets' : [b],
69+ 'descriptions' : descriptions,
6270 }));
6371 }
6472 // No need to flush - the data is not directly visible to the user either way.
@@ -352,8 +360,9 @@ class BucketState {
352360
353361final class SyncDataBatch {
354362 final List <SyncBucketData > buckets;
363+ final Map <String , BucketDescription > descriptions;
355364
356- SyncDataBatch (this .buckets);
365+ SyncDataBatch (this .buckets, this .descriptions );
357366}
358367
359368class SyncLocalDatabaseResult {
Original file line number Diff line number Diff line change @@ -433,8 +433,9 @@ class StreamingSyncImplementation implements StreamingSync {
433433 await adapter.removeBuckets (diff.removedBuckets);
434434 adapter.setTargetCheckpoint (targetCheckpoint);
435435 case SyncBucketData ():
436+ // TODO: Merge multiple of these into a single one...
436437 _updateStatus (downloading: true );
437- await adapter.saveSyncData (SyncDataBatch ([line]));
438+ await adapter.saveSyncData (SyncDataBatch ([line], bucketMap ));
438439 case StreamingSyncKeepalive ():
439440 if (line.tokenExpiresIn == 0 ) {
440441 // Token expired already - stop the connection immediately
You can’t perform that action at this time.
0 commit comments