dexie-cloud-addon 4.0.1-rc.2 → 4.0.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.0.1-rc.2, Wed Mar 20 2024
11
+ * Version 4.0.1-rc.3, Wed Mar 20 2024
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -5431,10 +5431,14 @@ function connectWebSocket(db) {
5431
5431
  return new BehaviorSubject([userLogin, syncState]);
5432
5432
  }), switchMap(([userLogin, syncState]) => __awaiter(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), distinctUntilChanged(([prevUser, prevHash], [currUser, currHash]) => prevUser === currUser && prevHash === currHash), switchMap(([userLogin, realmSetHash]) => {
5433
5433
  var _a;
5434
+ if (!((_a = db.cloud.persistedSyncState) === null || _a === void 0 ? void 0 : _a.value)) {
5435
+ // Restart the flow if persistedSyncState is not yet available.
5436
+ return createObservable();
5437
+ }
5434
5438
  // Let server end query changes from last entry of same client-ID and forward.
5435
5439
  // If no new entries, server won't bother the client. If new entries, server sends only those
5436
5440
  // and the baseRev of the last from same client-ID.
5437
- if (userLogin && ((_a = db.cloud.persistedSyncState) === null || _a === void 0 ? void 0 : _a.value)) {
5441
+ if (userLogin) {
5438
5442
  return new WSObservable(db.cloud.options.databaseUrl, db.cloud.persistedSyncState.value.serverRevision, realmSetHash, db.cloud.persistedSyncState.value.clientIdentity, messageProducer, db.cloud.webSocketStatus, userLogin.accessToken, userLogin.accessTokenExpiration);
5439
5443
  }
5440
5444
  else {
@@ -6286,7 +6290,7 @@ function dexieCloud(dexie) {
6286
6290
  const syncComplete = new Subject();
6287
6291
  dexie.cloud = {
6288
6292
  // @ts-ignore
6289
- version: "4.0.1-rc.2",
6293
+ version: "4.0.1-rc.3",
6290
6294
  options: Object.assign({}, DEFAULT_OPTIONS),
6291
6295
  schema: null,
6292
6296
  get currentUserId() {
@@ -6563,7 +6567,7 @@ function dexieCloud(dexie) {
6563
6567
  }
6564
6568
  }
6565
6569
  // @ts-ignore
6566
- dexieCloud.version = "4.0.1-rc.2";
6570
+ dexieCloud.version = "4.0.1-rc.3";
6567
6571
  Dexie.Cloud = dexieCloud;
6568
6572
 
6569
6573
  export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };