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
325325 this . syncStreamImplementation = this . generateSyncStreamImplementation ( connector ) ;
326326 this . syncStatusListenerDisposer = this . syncStreamImplementation . registerListener ( {
327327 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+ } ) ;
329332 this . iterateListeners ( ( cb ) => cb . statusChanged ?.( this . currentStatus ) ) ;
330333 }
331334 } ) ;
@@ -766,7 +769,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
766769 `SELECT DISTINCT tbl_name FROM sqlite_master WHERE rootpage IN (SELECT json_each.value FROM json_each(?))` ,
767770 [ JSON . stringify ( rootPages ) ]
768771 ) ;
769- for ( let table of tables ) {
772+ for ( const table of tables ) {
770773 resolvedTables . push ( table . tbl_name . replace ( POWERSYNC_TABLE_MATCH , '' ) ) ;
771774 }
772775 }
@@ -937,7 +940,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
937940 ? filteredTables
938941 : filteredTables . map ( ( t ) => t . replace ( POWERSYNC_TABLE_MATCH , '' ) ) ;
939942
940- for ( let table of mappedTableNames ) {
943+ for ( const table of mappedTableNames ) {
941944 changedTables . add ( table ) ;
942945 }
943946 }
You can’t perform that action at this time.
0 commit comments