@proveanything/smartlinks-auth-ui 0.1.18 → 0.1.20
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.
- package/dist/index.esm.js +6 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11245,9 +11245,8 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11245
11245
|
const [accountInfo, setAccountInfo] = React.useState(null);
|
|
11246
11246
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
11247
11247
|
const callbacksRef = React.useRef(new Set());
|
|
11248
|
-
// Initialization
|
|
11248
|
+
// Initialization guard to prevent concurrent runs (NOT persisted across remounts)
|
|
11249
11249
|
const initializingRef = React.useRef(false);
|
|
11250
|
-
const initializedRef = React.useRef(false);
|
|
11251
11250
|
// Notify all subscribers of auth state changes
|
|
11252
11251
|
const notifyAuthStateChange = React.useCallback((type, currentUser, currentToken, currentAccountData, currentAccountInfo) => {
|
|
11253
11252
|
callbacksRef.current.forEach(callback => {
|
|
@@ -11267,9 +11266,9 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11267
11266
|
}, []);
|
|
11268
11267
|
// Initialize auth state - different behavior for proxy mode vs standalone mode
|
|
11269
11268
|
React.useEffect(() => {
|
|
11270
|
-
// Prevent concurrent initialization
|
|
11271
|
-
if (initializingRef.current
|
|
11272
|
-
console.log('[AuthContext] Skipping initialization - already in progress
|
|
11269
|
+
// Prevent concurrent initialization only
|
|
11270
|
+
if (initializingRef.current) {
|
|
11271
|
+
console.log('[AuthContext] Skipping initialization - already in progress');
|
|
11273
11272
|
return;
|
|
11274
11273
|
}
|
|
11275
11274
|
let isMounted = true;
|
|
@@ -11308,7 +11307,6 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11308
11307
|
}
|
|
11309
11308
|
if (isMounted) {
|
|
11310
11309
|
setIsLoading(false);
|
|
11311
|
-
initializedRef.current = true;
|
|
11312
11310
|
initializingRef.current = false;
|
|
11313
11311
|
}
|
|
11314
11312
|
return;
|
|
@@ -11328,6 +11326,8 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11328
11326
|
setUser(storedUser);
|
|
11329
11327
|
setAccountData(storedAccountData);
|
|
11330
11328
|
console.log('[AuthContext] Session restored successfully');
|
|
11329
|
+
// Notify subscribers that session was restored (critical for app to know we're logged in)
|
|
11330
|
+
notifyAuthStateChange('LOGIN', storedUser, storedToken.token, storedAccountData || null);
|
|
11331
11331
|
}
|
|
11332
11332
|
}
|
|
11333
11333
|
catch (err) {
|
|
@@ -11350,7 +11350,6 @@ const AuthProvider = ({ children, proxyMode = false, accountCacheTTL = 5 * 60 *
|
|
|
11350
11350
|
finally {
|
|
11351
11351
|
if (isMounted) {
|
|
11352
11352
|
setIsLoading(false);
|
|
11353
|
-
initializedRef.current = true;
|
|
11354
11353
|
initializingRef.current = false;
|
|
11355
11354
|
}
|
|
11356
11355
|
}
|