File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/web/src/worker/sync Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -368,10 +368,18 @@ export class SharedSyncImplementation extends BaseObserver<SharedSyncImplementat
368368 }
369369
370370 // Re-index subscriptions, the subscriptions of the removed port would no longer be considered.
371- this . collectActiveSubscriptions ( ) ;
372371 if ( shouldReconnect ) {
373- // The internals of this needs a port mutex lock. It should be safe to start this operation here, but we cannot and don't need to await it.
374- this . connectionManager . connect ( CONNECTOR_PLACEHOLDER , this . lastConnectOptions ?? { } ) ;
372+ /**
373+ * The internals of this needs a port mutex lock.
374+ * It should be safe to start this operation here, but we cannot and don't need to await it.
375+ * Since we disconnected, we need to collectActiveSubscriptions after reconnecting.
376+ */
377+ this . connectionManager
378+ . connect ( CONNECTOR_PLACEHOLDER , this . lastConnectOptions ?? { } )
379+ . then ( ( ) => this . collectActiveSubscriptions ( ) ) ;
380+ } else {
381+ // The port removed was not the database in use. We didn't need to reconnect explicitly, but we need to update the subscriptions.
382+ this . collectActiveSubscriptions ( ) ;
375383 }
376384
377385 return ( ) => trackedPort . clientProvider [ Comlink . releaseProxy ] ( ) ;
You can’t perform that action at this time.
0 commit comments