File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
packages/common/src/client Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @powersync/common " : patch
3
+ ---
4
+
5
+ Fix hasSynced to change when there is no data on app load
Original file line number Diff line number Diff line change @@ -325,7 +325,10 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
325
325
this . syncStreamImplementation = this . generateSyncStreamImplementation ( connector ) ;
326
326
this . syncStatusListenerDisposer = this . syncStreamImplementation . registerListener ( {
327
327
statusChanged : ( status ) => {
328
- this . currentStatus = new SyncStatus ( { ...status . toJSON ( ) , hasSynced : this . currentStatus ?. hasSynced } ) ;
328
+ this . currentStatus = new SyncStatus ( {
329
+ ...status . toJSON ( ) ,
330
+ hasSynced : this . currentStatus ?. hasSynced || ! ! status . lastSyncedAt
331
+ } ) ;
329
332
this . iterateListeners ( ( cb ) => cb . statusChanged ?.( this . currentStatus ) ) ;
330
333
}
331
334
} ) ;
@@ -766,7 +769,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
766
769
`SELECT DISTINCT tbl_name FROM sqlite_master WHERE rootpage IN (SELECT json_each.value FROM json_each(?))` ,
767
770
[ JSON . stringify ( rootPages ) ]
768
771
) ;
769
- for ( let table of tables ) {
772
+ for ( const table of tables ) {
770
773
resolvedTables . push ( table . tbl_name . replace ( POWERSYNC_TABLE_MATCH , '' ) ) ;
771
774
}
772
775
}
@@ -937,7 +940,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
937
940
? filteredTables
938
941
: filteredTables . map ( ( t ) => t . replace ( POWERSYNC_TABLE_MATCH , '' ) ) ;
939
942
940
- for ( let table of mappedTableNames ) {
943
+ for ( const table of mappedTableNames ) {
941
944
changedTables . add ( table ) ;
942
945
}
943
946
}
You can’t perform that action at this time.
0 commit comments