File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
packages/astro/src/server Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @clerk/astro " : patch
3+ ---
4+
5+ Add backwards compatibility for ignoring prerendered routes in Astro
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export const clerkMiddleware: ClerkMiddleware = (...args: unknown[]): any => {
6262
6363 const astroMiddleware : AstroMiddleware = async ( context , next ) => {
6464 // if the current page is prerendered, do nothing
65- if ( 'isPrerendered' in context && context . isPrerendered ) {
65+ if ( isPrerenderedPage ( context ) ) {
6666 return next ( ) ;
6767 }
6868
@@ -129,6 +129,15 @@ export const clerkMiddleware: ClerkMiddleware = (...args: unknown[]): any => {
129129 return astroMiddleware ;
130130} ;
131131
132+ const isPrerenderedPage = ( context : APIContext ) => {
133+ return (
134+ // for Astro v5
135+ ( 'isPrerendered' in context && context . isPrerendered ) ||
136+ // for Astro v4
137+ ( '_isPrerendered' in context && context . _isPrerendered )
138+ ) ;
139+ } ;
140+
132141// TODO-SHARED: Duplicate from '@clerk/nextjs'
133142const parseHandlerAndOptions = ( args : unknown [ ] ) => {
134143 return [
You can’t perform that action at this time.
0 commit comments