dexie-cloud-addon 4.3.7 → 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.7, Wed Jan 28 2026
11
+ * Version 4.3.9, Thu Jan 29 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -6068,7 +6068,7 @@ function associate(factory) {
6068
6068
  };
6069
6069
  }
6070
6070
 
6071
- const getCurrentUserEmitter = associate((db) => new BehaviorSubject(UNAUTHORIZED_USER));
6071
+ const getCurrentUserEmitter = associate((db) => new BehaviorSubject(Object.assign(Object.assign({}, UNAUTHORIZED_USER), { isLoading: true })));
6072
6072
 
6073
6073
  function computeSyncState(db) {
6074
6074
  let _prevStatus = db.cloud.webSocketStatus.value;
@@ -6703,7 +6703,7 @@ function dexieCloud(dexie) {
6703
6703
  const syncComplete = new Subject();
6704
6704
  dexie.cloud = {
6705
6705
  // @ts-ignore
6706
- version: "4.3.7",
6706
+ version: "4.3.9",
6707
6707
  options: Object.assign({}, DEFAULT_OPTIONS),
6708
6708
  schema: null,
6709
6709
  get currentUserId() {
@@ -6744,8 +6744,6 @@ function dexieCloud(dexie) {
6744
6744
  try {
6745
6745
  const callback = parseOAuthCallback();
6746
6746
  if (callback) {
6747
- // Clean up URL immediately (remove dxc-auth param)
6748
- cleanupOAuthUrl();
6749
6747
  // Store the pending auth code for processing when db is ready
6750
6748
  pendingOAuthCode = { code: callback.code, provider: callback.provider };
6751
6749
  console.debug('[dexie-cloud] OAuth callback detected, auth code stored for processing');
@@ -6753,7 +6751,6 @@ function dexieCloud(dexie) {
6753
6751
  }
6754
6752
  catch (error) {
6755
6753
  // parseOAuthCallback throws OAuthError on error callbacks
6756
- cleanupOAuthUrl();
6757
6754
  if (error instanceof OAuthError) {
6758
6755
  pendingOAuthError = error;
6759
6756
  console.error('[dexie-cloud] OAuth callback error:', error.message);
@@ -6947,7 +6944,14 @@ function dexieCloud(dexie) {
6947
6944
  // Manage CurrentUser observable:
6948
6945
  throwIfClosed();
6949
6946
  if (!db.cloud.isServiceWorkerDB) {
6950
- 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));
6951
6955
  // Manage PersistendSyncState observable:
6952
6956
  subscriptions.push(liveQuery(() => db.getPersistedSyncState()).subscribe(db.cloud.persistedSyncState));
6953
6957
  // Wait till currentUser and persistedSyncState gets populated
@@ -6981,6 +6985,8 @@ function dexieCloud(dexie) {
6981
6985
  message: error.message,
6982
6986
  messageParams: { provider: error.provider || 'unknown' }
6983
6987
  });
6988
+ // Clean up URL (remove dxc-auth param)
6989
+ cleanupOAuthUrl();
6984
6990
  }
6985
6991
  catch (uiError) {
6986
6992
  console.error('[dexie-cloud] Failed to show OAuth error alert:', uiError);
@@ -6994,6 +7000,8 @@ function dexieCloud(dexie) {
6994
7000
  try {
6995
7001
  changedUser = yield login(db, { oauthCode: code, provider });
6996
7002
  user = yield db.getCurrentUser();
7003
+ // Clean up URL (remove dxc-auth param)
7004
+ cleanupOAuthUrl();
6997
7005
  }
6998
7006
  catch (error) {
6999
7007
  console.error('[dexie-cloud] OAuth login failed:', error);
@@ -7088,7 +7096,7 @@ function dexieCloud(dexie) {
7088
7096
  }
7089
7097
  }
7090
7098
  // @ts-ignore
7091
- dexieCloud.version = "4.3.7";
7099
+ dexieCloud.version = "4.3.9";
7092
7100
  Dexie.Cloud = dexieCloud;
7093
7101
 
7094
7102
  // In case the SW lives for a while, let it reuse already opened connections: