@@ -156,6 +156,7 @@ export abstract class AbstractStreamingSyncImplementation
156
156
157
157
this . syncStatus = new SyncStatus ( {
158
158
connected : false ,
159
+ connecting : false ,
159
160
lastSyncedAt : undefined ,
160
161
dataFlow : {
161
162
uploading : false ,
@@ -347,7 +348,7 @@ The next upload iteration will be delayed.`);
347
348
this . streamingSyncPromise = undefined ;
348
349
349
350
this . abortController = null ;
350
- this . updateSyncStatus ( { connected : false } ) ;
351
+ this . updateSyncStatus ( { connected : false , connecting : false } ) ;
351
352
}
352
353
353
354
/**
@@ -382,6 +383,7 @@ The next upload iteration will be delayed.`);
382
383
this . crudUpdateListener = undefined ;
383
384
this . updateSyncStatus ( {
384
385
connected : false ,
386
+ connecting : false ,
385
387
dataFlow : {
386
388
downloading : false
387
389
}
@@ -395,6 +397,7 @@ The next upload iteration will be delayed.`);
395
397
* - Close any sync stream ReadableStreams (which will also close any established network requests)
396
398
*/
397
399
while ( true ) {
400
+ this . updateSyncStatus ( { connecting : true } ) ;
398
401
try {
399
402
if ( signal ?. aborted ) {
400
403
break ;
@@ -423,6 +426,8 @@ The next upload iteration will be delayed.`);
423
426
} else {
424
427
this . logger . error ( ex ) ;
425
428
}
429
+
430
+ // On error, wait a little before retrying
426
431
await this . delayRetry ( ) ;
427
432
} finally {
428
433
if ( ! signal . aborted ) {
@@ -431,15 +436,14 @@ The next upload iteration will be delayed.`);
431
436
}
432
437
433
438
this . updateSyncStatus ( {
434
- connected : false
439
+ connected : false ,
440
+ connecting : true // May be unnecessary
435
441
} ) ;
436
-
437
- // On error, wait a little before retrying
438
442
}
439
443
}
440
444
441
445
// Mark as disconnected if here
442
- this . updateSyncStatus ( { connected : false } ) ;
446
+ this . updateSyncStatus ( { connected : false , connecting : false } ) ;
443
447
}
444
448
445
449
protected async streamingSyncIteration (
@@ -647,6 +651,7 @@ The next upload iteration will be delayed.`);
647
651
protected updateSyncStatus ( options : SyncStatusOptions ) {
648
652
const updatedStatus = new SyncStatus ( {
649
653
connected : options . connected ?? this . syncStatus . connected ,
654
+ connecting : ! options . connected && ( options . connecting ?? this . syncStatus . connecting ) ,
650
655
lastSyncedAt : options . lastSyncedAt ?? this . syncStatus . lastSyncedAt ,
651
656
dataFlow : {
652
657
...this . syncStatus . dataFlowStatus ,
0 commit comments