File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3
3
{ "path" : " ./dist/clerk.js" , "maxSize" : " 612kB" },
4
4
{ "path" : " ./dist/clerk.browser.js" , "maxSize" : " 72.2KB" },
5
5
{ "path" : " ./dist/clerk.legacy.browser.js" , "maxSize" : " 115KB" },
6
- { "path" : " ./dist/clerk.headless*.js" , "maxSize" : " 53.06KB " },
6
+ { "path" : " ./dist/clerk.headless*.js" , "maxSize" : " 55KB " },
7
7
{ "path" : " ./dist/ui-common*.js" , "maxSize" : " 108.56KB" },
8
8
{ "path" : " ./dist/vendors*.js" , "maxSize" : " 40.2KB" },
9
9
{ "path" : " ./dist/coinbase*.js" , "maxSize" : " 38KB" },
Original file line number Diff line number Diff line change @@ -1283,7 +1283,16 @@ export class Clerk implements ClerkInterface {
1283
1283
} ;
1284
1284
1285
1285
public __experimental_navigateToTask = async ( { redirectUrlComplete } : NextTaskParams = { } ) : Promise < void > => {
1286
- const session = await this . session ?. reload ( ) ;
1286
+ /**
1287
+ * Invalidate previously cache pages with auth state before navigating
1288
+ */
1289
+ const onBeforeSetActive : SetActiveHook =
1290
+ typeof window !== 'undefined' && typeof window . __unstable__onBeforeSetActive === 'function'
1291
+ ? window . __unstable__onBeforeSetActive
1292
+ : noop ;
1293
+ await onBeforeSetActive ( ) ;
1294
+
1295
+ const session = this . session ;
1287
1296
if ( ! session || ! this . environment ) {
1288
1297
return ;
1289
1298
}
@@ -1311,6 +1320,17 @@ export class Clerk implements ClerkInterface {
1311
1320
1312
1321
this . #setAccessors( session ) ;
1313
1322
this . #emit( ) ;
1323
+
1324
+ /**
1325
+ * Invoke the Next.js middleware to synchronize server and client state after resolving a session task.
1326
+ * This ensures that any server-side logic depending on the session status (like middleware-based
1327
+ * redirects or protected routes) correctly reflects the updated client authentication state.
1328
+ */
1329
+ const onAfterSetActive : SetActiveHook =
1330
+ typeof window !== 'undefined' && typeof window . __unstable__onAfterSetActive === 'function'
1331
+ ? window . __unstable__onAfterSetActive
1332
+ : noop ;
1333
+ await onAfterSetActive ( ) ;
1314
1334
} ;
1315
1335
1316
1336
public addListener = ( listener : ListenerCallback ) : UnsubscribeCallback => {
You can’t perform that action at this time.
0 commit comments