@@ -129,7 +129,8 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
129129 final hasSynced = timestamp != null ;
130130
131131 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 ();
133134 final status =
134135 SyncStatus (hasSynced: hasSynced, lastSyncedAt: lastSyncedAt);
135136 setStatus (status);
@@ -157,7 +158,8 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
157158 // The previous values of hasSynced should be preserved here.
158159 hasSynced: status.lastSyncedAt != null
159160 ? true
160- : status.hasSynced ?? currentStatus.hasSynced);
161+ : status.hasSynced ?? currentStatus.hasSynced,
162+ lastSyncedAt: status.lastSyncedAt ?? currentStatus.lastSyncedAt);
161163 statusStreamController.add (currentStatus);
162164 }
163165 }
@@ -260,7 +262,8 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
260262 await tx.execute ('select powersync_clear(?)' , [clearLocal ? 1 : 0 ]);
261263 });
262264 // 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);
264267 }
265268
266269 @Deprecated ('Use [disconnectAndClear] instead.' )
0 commit comments