@@ -129,7 +129,8 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
129
129
final hasSynced = timestamp != null ;
130
130
131
131
if (hasSynced != currentStatus.hasSynced) {
132
- final lastSyncedAt = timestamp == null ? null : DateTime .parse (timestamp);
132
+ final lastSyncedAt =
133
+ timestamp == null ? null : DateTime .parse ('${timestamp }Z' ).toLocal ();
133
134
final status =
134
135
SyncStatus (hasSynced: hasSynced, lastSyncedAt: lastSyncedAt);
135
136
setStatus (status);
@@ -157,7 +158,8 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
157
158
// The previous values of hasSynced should be preserved here.
158
159
hasSynced: status.lastSyncedAt != null
159
160
? true
160
- : status.hasSynced ?? currentStatus.hasSynced);
161
+ : status.hasSynced ?? currentStatus.hasSynced,
162
+ lastSyncedAt: status.lastSyncedAt ?? currentStatus.lastSyncedAt);
161
163
statusStreamController.add (currentStatus);
162
164
}
163
165
}
@@ -260,7 +262,8 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
260
262
await tx.execute ('select powersync_clear(?)' , [clearLocal ? 1 : 0 ]);
261
263
});
262
264
// The data has been deleted - reset these
263
- setStatus (SyncStatus (lastSyncedAt: null , hasSynced: false ));
265
+ currentStatus = SyncStatus (lastSyncedAt: null , hasSynced: false );
266
+ statusStreamController.add (currentStatus);
264
267
}
265
268
266
269
@Deprecated ('Use [disconnectAndClear] instead.' )
0 commit comments