Skip to content

fix(ui): Ensure cssLayerName from appearance is preserved during updateProps#8490

Open
alexcarpenter wants to merge 3 commits intomainfrom
carp/fix-extractCssLayerNameFromAppearance-update-props
Open

fix(ui): Ensure cssLayerName from appearance is preserved during updateProps#8490
alexcarpenter wants to merge 3 commits intomainfrom
carp/fix-extractCssLayerNameFromAppearance-update-props

Conversation

@alexcarpenter
Copy link
Copy Markdown
Member

@alexcarpenter alexcarpenter commented May 6, 2026

Description

Fix cssLayerName from theme not being applied after initial mount. When ClerkProvider re-renders, the updateProps handler overwrote the extracted cssLayerName with the raw appearance object, causing Clerk's runtime CSS to not be wrapped in @layer. This broke Tailwind utility overrides when using themes like shadcn that set cssLayerName: 'components'.

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:

@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 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 May 6, 2026 6:38pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 6, 2026

🦋 Changeset detected

Latest commit: a675237

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

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension 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

@github-actions github-actions Bot added the ui label May 6, 2026
@alexcarpenter alexcarpenter changed the title fix(ui): Ensure cssLayerName from appearance is preserved during upda… fix(ui): Ensure cssLayerName from appearance is preserved during updateProps May 6, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6b73d146-9346-4888-8e64-8a488da2be31

📥 Commits

Reviewing files that changed from the base of the PR and between 556b0f6 and a675237.

📒 Files selected for processing (1)
  • packages/ui/src/utils/__tests__/extractCssLayerNameFromAppearance.test.ts

📝 Walkthrough

Walkthrough

This PR patches @clerk/ui to prevent losing cssLayerName during runtime prop updates. It adds normalization in updateProps to extract a cssLayerName from appearance (including theme arrays) and promote it to the appearance level before merging state. A new unit test file exercises extraction from single-theme and theme-array inputs, preserves explicit appearance-level values, and reproduces the original buggy merge versus the fixed merge behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main fix: ensuring cssLayerName preservation during updateProps in the UI package.
Description check ✅ Passed The description clearly explains the bug, root cause, and impact related to cssLayerName not being applied after initial mount during ClerkProvider re-renders.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 6, 2026

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8490

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: a675237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants