File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @clerk/clerk-js ' : patch
3
+ ---
4
+
5
+ Fix server-side session cache not being invalidated for after-auth custom flows
Original file line number Diff line number Diff line change 1
1
{
2
2
"files" : [
3
3
{ "path" : " ./dist/clerk.js" , "maxSize" : " 618KB" },
4
- { "path" : " ./dist/clerk.browser.js" , "maxSize" : " 72.2KB " },
4
+ { "path" : " ./dist/clerk.browser.js" , "maxSize" : " 74KB " },
5
5
{ "path" : " ./dist/clerk.legacy.browser.js" , "maxSize" : " 115.08KB" },
6
6
{ "path" : " ./dist/clerk.headless*.js" , "maxSize" : " 55KB" },
7
7
{ "path" : " ./dist/ui-common*.js" , "maxSize" : " 113KB" },
Original file line number Diff line number Diff line change @@ -1325,6 +1325,29 @@ export class Clerk implements ClerkInterface {
1325
1325
} ;
1326
1326
1327
1327
#handlePendingSession = async ( session : PendingSessionResource ) => {
1328
+ /**
1329
+ * Do not revalidate server cache when `setActive` is called with a pending
1330
+ * session within components, to avoid flash of content and unmount during
1331
+ * internal navigation
1332
+ */
1333
+ const shouldInvalidateCache = ! this . #componentNavigationContext;
1334
+
1335
+ const onBeforeSetActive : SetActiveHook =
1336
+ shouldInvalidateCache &&
1337
+ typeof window !== 'undefined' &&
1338
+ typeof window . __unstable__onBeforeSetActive === 'function'
1339
+ ? window . __unstable__onBeforeSetActive
1340
+ : noop ;
1341
+
1342
+ const onAfterSetActive : SetActiveHook =
1343
+ shouldInvalidateCache &&
1344
+ typeof window !== 'undefined' &&
1345
+ typeof window . __unstable__onAfterSetActive === 'function'
1346
+ ? window . __unstable__onAfterSetActive
1347
+ : noop ;
1348
+
1349
+ await onBeforeSetActive ( ) ;
1350
+
1328
1351
if ( ! this . environment ) {
1329
1352
return ;
1330
1353
}
@@ -1358,6 +1381,8 @@ export class Clerk implements ClerkInterface {
1358
1381
1359
1382
this . #setAccessors( session ) ;
1360
1383
this . #emit( ) ;
1384
+
1385
+ await onAfterSetActive ( ) ;
1361
1386
} ;
1362
1387
1363
1388
public __internal_navigateToTaskIfAvailable = async ( {
You can’t perform that action at this time.
0 commit comments