fix(ui): break circular import between styled-system and primitives#8754
Conversation
InternalThemeProvider imported useAppearance from the customizables barrel, which eagerly loads primitives; Box then calls createVariants from the styledSystem barrel at module-eval time, closing a cycle back into a barrel that has not finished initializing. Import useAppearance from customizables/AppearanceContext (a leaf that only references styledSystem via a type-only import) so the barrel edge is dropped and the cycle is broken. Latent under tree-shaking; surfaced when the dev Rspack config disabled providedExports/usedExports.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 86e4db6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR resolves a circular import issue in the styled-system module. The fix changes Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
Break Check: no API changes detected across the tracked packages. Last ran on |
Breaks a latent circular import in the styled-system that started crashing the Dashboard dev build once the dev Rspack config turned off tree-shaking (
providedExports/usedExports).The loop:
InternalThemeProviderimportsuseAppearancefrom thecustomizablesbarrel, which eagerly loadsprimitives, whoseBoxcallscreateVariantsfrom thestyledSystembarrel at module-eval time, re-entering a barrel that hasn't finished initializing.useAppearanceactually lives in thecustomizables/AppearanceContextleaf, and that leaf's subtree only referencesstyledSystemthrough a type-only import, so pointing the import there directly pulls nothing back in and severs the cycle.