fix(astro): ignore prerendered pages in middleware#4640
fix(astro): ignore prerendered pages in middleware#4640tmilewski merged 4 commits intoclerk:mainfrom jlengstorf:fix-4639/astro-ignore-prerendered-pages
Conversation
🦋 Changeset detectedLatest commit: 8b9eff5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Thanks, @jlengstorf! |
|
Thanks @jlengstorf! In case you still want to protect CSR pages, you can use the exported stores: ---
export async function getStaticPaths() {
// other code
}
---
<!-- other code -->
<script>
import { $authStore } from '@clerk/astro/client'
$authStore.subscribe((auth) => {
if (auth.userId === undefined) {
// loading
} else if (auth.userId === null) {
// redirect to sign-in page
}
})
</script> |
|
As far as I know, Right now, the property is called |
Okay, I can confirm it's still |
Hm, I don't think so. I'm using Astro v4.16.16 and all I see is |
@wobsoriano Cool. Something like this should work for all versions: const isPrerendered = (context: any) => context._isPrerendered || context.isPrerendered |
|
sorry about that! I'm using Astro 5 😅 |
Co-authored-by: Tom Milewski <me@tm.codes>
fixes #4639
Description
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change