-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(astro): ignore prerendered pages in middleware #4640
fix(astro): ignore prerendered pages in middleware #4640
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 😅 |
fixes #4639
Description
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change