Skip to content

Conversation

@wobsoriano
Copy link
Member

@wobsoriano wobsoriano commented Jan 30, 2026

Description

Port of #7708 but using the <Show> component

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an error when using Clerk Control components on prerendered pages to improve compatibility with static builds.
  • New Features

    • Added a prerendered example page and a new "Prerendered Page" card in the signed-in UI to demonstrate prerendered behavior and client-side reveal.
  • Tests

    • Added end-to-end tests validating signed-out and signed-in states on prerendered pages.
  • Chores

    • Added a changeset for a patch release.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 30, 2026

🦋 Changeset detected

Latest commit: 53495be

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/astro Patch

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

@vercel
Copy link

vercel bot commented Jan 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 30, 2026 5:16pm

Request Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 30, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7710

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7710

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7710

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7710

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7710

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7710

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7710

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7710

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7710

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7710

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7710

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7710

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7710

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7710

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7710

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7710

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7710

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7710

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7710

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7710

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7710

commit: 53495be

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

Adds a changeset documenting a patch release for @clerk/astro. Modifies packages/astro/src/astro-components/control/Show.astro to decide CSR vs SSR based on an optional isStatic prop or runtime detection of Astro.locals.auth, introducing shouldUseCSR and hasShowFallback and updated slot fallback logic. Adds a prerendered page (export const prerender = true) at integration/templates/astro-node/src/pages/prerendered.astro and a linking card in the index. Adds a test case (duplicated insertion) verifying Show behavior on prerendered pages for signed-out and signed-in flows.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The linked issue CORE-3 provides no actionable coding requirements or acceptance criteria; it only states the fix was intentional, making compliance assessment impossible. Clarify the linked issue with specific coding requirements, acceptance criteria, or functional expectations to enable proper validation.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: making the Show component automatically use CSR on prerendered pages, which aligns with the code modifications to Show.astro component logic.
Out of Scope Changes check ✅ Passed All changes (Show.astro logic, new prerendered test page, test cases, and changeset) are directly related to enabling the Show component to work correctly on prerendered pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/astro/src/astro-components/control/Show.astro`:
- Around line 25-28: Guard access to Astro.locals.auth when computing
shouldUseCSR to avoid crashes on prerendered pages: change the logic that sets
shouldUseCSR (currently using isStatic !== undefined ? isStaticOutput(isStatic)
: !Astro.locals.auth) to first detect prerendered context (e.g., via
isPrerenderedPage or by checking Astro.locals existence) and only read
Astro.locals.auth when safe; keep the fallback to isStaticOutput(isStatic) when
isStatic is provided and preserve selecting ShowComponent = shouldUseCSR ?
ShowCSR : ShowSSR. Also add unit/integration tests that verify Show renders with
CSR when runtime auth is present, with SSR when not, and that prerendered pages
do not throw when Astro.locals is undefined.

@wobsoriano wobsoriano changed the title fix(astro): Automatically use CSR control components for prerendered pages fix(astro): Automatically use CSR Show component for prerendered pages Jan 30, 2026
Copy link
Member

@jacekradko jacekradko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@wobsoriano wobsoriano enabled auto-merge (squash) January 30, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants