@@ -28,9 +28,9 @@ import type {
28
28
AuthenticateWithGoogleOneTapParams ,
29
29
AuthenticateWithMetamaskParams ,
30
30
AuthenticateWithOKXWalletParams ,
31
- Clerk as ClerkInterface ,
32
31
ClerkAPIError ,
33
32
ClerkAuthenticateWithWeb3Params ,
33
+ Clerk as ClerkInterface ,
34
34
ClerkOptions ,
35
35
ClientJSONSnapshot ,
36
36
ClientResource ,
@@ -1233,9 +1233,7 @@ export class Clerk implements ClerkInterface {
1233
1233
: noop ;
1234
1234
1235
1235
let newSession = session === undefined ? this . session : session ;
1236
- const sessionIsPending = newSession ?. status === 'pending' ;
1237
-
1238
- if ( sessionIsPending ) {
1236
+ if ( newSession ?. status === 'pending' ) {
1239
1237
warnMissingPendingTaskHandlers ( { ...this . #options, ...params } ) ;
1240
1238
}
1241
1239
@@ -1309,7 +1307,10 @@ export class Clerk implements ClerkInterface {
1309
1307
}
1310
1308
1311
1309
const taskUrl =
1312
- sessionIsPending && newSession ?. currentTask && this . #options. taskUrls ?. [ newSession ?. currentTask . key ] ;
1310
+ newSession ?. status === 'pending' &&
1311
+ newSession ?. currentTask &&
1312
+ this . #options. taskUrls ?. [ newSession ?. currentTask . key ] ;
1313
+
1313
1314
const shouldNavigate = ( redirectUrl || taskUrl || setActiveNavigate ) && ! beforeEmit ;
1314
1315
if ( shouldNavigate ) {
1315
1316
await tracker . track ( async ( ) => {
@@ -1318,7 +1319,7 @@ export class Clerk implements ClerkInterface {
1318
1319
return ;
1319
1320
}
1320
1321
1321
- if ( ! sessionIsPending ) {
1322
+ if ( newSession ?. status !== 'pending' ) {
1322
1323
this . #setTransitiveState( ) ;
1323
1324
}
1324
1325
@@ -1361,7 +1362,8 @@ export class Clerk implements ClerkInterface {
1361
1362
this . #emit( ) ;
1362
1363
1363
1364
// Do not revalidate server cache for pending sessions to avoid unmount of `SignIn/SignUp` AIOs when navigating to task
1364
- if ( ! sessionIsPending || newSession ?. status === 'active' ) {
1365
+ // newSession can be mutated by the time we get here (org change session touch)
1366
+ if ( newSession ?. status !== 'pending' ) {
1365
1367
await onAfterSetActive ( ) ;
1366
1368
}
1367
1369
} finally {
0 commit comments