@@ -1317,9 +1317,8 @@ export class Clerk implements ClerkInterface {
13171317 eventBus . emit ( events . TokenUpdate , { token : null } ) ;
13181318 }
13191319
1320- // Only triggers navigation for internal AIO components routing or multi-session switch
1321- const isSwitchingSessions = this . session ?. id != session . id ;
1322- const shouldNavigateOnSetActive = this . #componentNavigationContext || isSwitchingSessions ;
1320+ // Only triggers navigation for internal AIO components routing
1321+ const shouldNavigateOnSetActive = this . #componentNavigationContext;
13231322 if ( newSession ?. currentTask && shouldNavigateOnSetActive ) {
13241323 await navigateToTask ( session . currentTask . key , {
13251324 options : this . #options,
@@ -1333,16 +1332,7 @@ export class Clerk implements ClerkInterface {
13331332 this . #emit( ) ;
13341333 } ;
13351334
1336- public __experimental_navigateToTask = async ( { redirectUrlComplete } : NextTaskParams = { } ) : Promise < void > => {
1337- /**
1338- * Invalidate previously cached pages with auth state before navigating
1339- */
1340- const onBeforeSetActive : SetActiveHook =
1341- typeof window !== 'undefined' && typeof window . __unstable__onBeforeSetActive === 'function'
1342- ? window . __unstable__onBeforeSetActive
1343- : noop ;
1344- await onBeforeSetActive ( ) ;
1345-
1335+ public __internal_navigateToTaskIfAvailable = async ( { redirectUrlComplete } : NextTaskParams = { } ) : Promise < void > => {
13461336 const session = this . session ;
13471337 if ( ! session || ! this . environment ) {
13481338 return ;
@@ -1368,20 +1358,6 @@ export class Clerk implements ClerkInterface {
13681358 if ( tracker . isUnloading ( ) ) {
13691359 return ;
13701360 }
1371-
1372- this . #setAccessors( session ) ;
1373- this . #emit( ) ;
1374-
1375- /**
1376- * Invoke the Next.js middleware to synchronize server and client state after resolving a session task.
1377- * This ensures that any server-side logic depending on the session status (like middleware-based
1378- * redirects or protected routes) correctly reflects the updated client authentication state.
1379- */
1380- const onAfterSetActive : SetActiveHook =
1381- typeof window !== 'undefined' && typeof window . __unstable__onAfterSetActive === 'function'
1382- ? window . __unstable__onAfterSetActive
1383- : noop ;
1384- await onAfterSetActive ( ) ;
13851361 } ;
13861362
13871363 public addListener = ( listener : ListenerCallback ) : UnsubscribeCallback => {
0 commit comments