dexie-cloud-addon 4.3.8 → 4.3.9

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.3.8, Thu Jan 29 2026
11
+ * Version 4.3.9, Thu Jan 29 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -6068,9 +6068,7 @@ function associate(factory) {
6068
6068
  };
6069
6069
  }
6070
6070
 
6071
- const isOathCallback = typeof location !== 'undefined' && !!(new URL(location.href)).searchParams.get('dxc-auth');
6072
- const getCurrentUserEmitter = associate((db) => new BehaviorSubject(isOathCallback
6073
- ? Object.assign(Object.assign({}, UNAUTHORIZED_USER), { oauthInProgress: true }) : UNAUTHORIZED_USER));
6071
+ const getCurrentUserEmitter = associate((db) => new BehaviorSubject(Object.assign(Object.assign({}, UNAUTHORIZED_USER), { isLoading: true })));
6074
6072
 
6075
6073
  function computeSyncState(db) {
6076
6074
  let _prevStatus = db.cloud.webSocketStatus.value;
@@ -6705,7 +6703,7 @@ function dexieCloud(dexie) {
6705
6703
  const syncComplete = new Subject();
6706
6704
  dexie.cloud = {
6707
6705
  // @ts-ignore
6708
- version: "4.3.8",
6706
+ version: "4.3.9",
6709
6707
  options: Object.assign({}, DEFAULT_OPTIONS),
6710
6708
  schema: null,
6711
6709
  get currentUserId() {
@@ -6946,7 +6944,14 @@ function dexieCloud(dexie) {
6946
6944
  // Manage CurrentUser observable:
6947
6945
  throwIfClosed();
6948
6946
  if (!db.cloud.isServiceWorkerDB) {
6949
- subscriptions.push(liveQuery(() => db.getCurrentUser()).subscribe(currentUserEmitter));
6947
+ subscriptions.push(liveQuery(() => db.getCurrentUser().then(user => {
6948
+ if (!user.isLoggedIn && typeof location !== 'undefined' && /dxc-auth\=/.test(location.search)) {
6949
+ // Still loading user because OAuth redirect just happened.
6950
+ // Keep isLoading true.
6951
+ return Object.assign(Object.assign({}, user), { isLoading: true });
6952
+ }
6953
+ return user;
6954
+ })).subscribe(currentUserEmitter));
6950
6955
  // Manage PersistendSyncState observable:
6951
6956
  subscriptions.push(liveQuery(() => db.getPersistedSyncState()).subscribe(db.cloud.persistedSyncState));
6952
6957
  // Wait till currentUser and persistedSyncState gets populated
@@ -6982,7 +6987,6 @@ function dexieCloud(dexie) {
6982
6987
  });
6983
6988
  // Clean up URL (remove dxc-auth param)
6984
6989
  cleanupOAuthUrl();
6985
- currentUserEmitter.next(Object.assign(Object.assign({}, currentUserEmitter.value), { oauthInProgress: false }));
6986
6990
  }
6987
6991
  catch (uiError) {
6988
6992
  console.error('[dexie-cloud] Failed to show OAuth error alert:', uiError);
@@ -7092,7 +7096,7 @@ function dexieCloud(dexie) {
7092
7096
  }
7093
7097
  }
7094
7098
  // @ts-ignore
7095
- dexieCloud.version = "4.3.8";
7099
+ dexieCloud.version = "4.3.9";
7096
7100
  Dexie.Cloud = dexieCloud;
7097
7101
 
7098
7102
  // In case the SW lives for a while, let it reuse already opened connections: