feat(astro,nuxt,react-router,tanstack-react-start): Env-var to suppress dev keys warning#8402
feat(astro,nuxt,react-router,tanstack-react-start): Env-var to suppress dev keys warning#8402jacekradko wants to merge 2 commits intomainfrom
Conversation
…r shortcut for unsafe_disableDevelopmentModeConsoleWarning
🦋 Changeset detectedLatest commit: e92b2e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📝 WalkthroughWalkthroughThis pull request adds support for an Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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/dev-cli
@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: |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/astro/src/internal/merge-env-vars-with-params.ts`:
- Around line 69-71: The boolean precedence bug: change the fallback logic for
unsafe_disableDevelopmentModeConsoleWarning so an explicit false passed via
paramUnsafeDisableDevelopmentModeConsoleWarning is not overridden by the env
value; locate the unsafe_disableDevelopmentModeConsoleWarning assignment and
replace the use of || (which treats false as unset) with a nullish-coalescing or
explicit undefined check (e.g., use ?? or check
paramUnsafeDisableDevelopmentModeConsoleWarning !== undefined) to prefer the
provided parameter when it's false and only use
import.meta.env.PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING
when the parameter is nullish/undefined.
In `@packages/tanstack-react-start/src/client/utils.ts`:
- Around line 80-81: The merge for unsafe_disableDevelopmentModeConsoleWarning
currently uses the || operator so a deliberate false in restInitState is treated
as absent; change the fallback to use nullish coalescing (??) when computing
unsafe_disableDevelopmentModeConsoleWarning so that only null/undefined fall
back to envVars.unsafeDisableDevelopmentModeConsoleWarning, preserving explicit
false values in restInitState and envVars.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: be5871bc-f61d-4083-b137-7f19f771aae2
📒 Files selected for processing (10)
.changeset/quiet-dev-keys-warning.mdpackages/astro/src/internal/merge-env-vars-with-params.tspackages/nuxt/src/module.tspackages/react-router/src/client/ReactRouterClerkProvider.tsxpackages/react-router/src/client/types.tspackages/react-router/src/server/utils.tspackages/react-router/src/utils/env.tspackages/shared/src/types/clerk.tspackages/tanstack-react-start/src/client/utils.tspackages/tanstack-react-start/src/utils/env.ts
Summary
The
unsafe_disableDevelopmentModeConsoleWarningoption has shipped on<ClerkProvider>for a while, but until now Next.js was the only framework integration with an env-var shortcut. This PR brings the same convenience to Astro, Nuxt, React Router, and TanStack Start so the development-keys warning can be suppressed without threading the option through<ClerkProvider>manually.PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNINGNUXT_PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNINGVITE_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING(or unprefixed)VITE_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING(or unprefixed)The JSDoc on
unsafe_disableDevelopmentModeConsoleWarningnow lists every framework's env-var shortcut and notes that suppressing the warning at source also keeps it from being mirrored into the dev-server terminal (e.g. Next.js withexperimental.browserDebugInfoInTerminal).The wiring follows each framework's existing pattern:
import.meta.envinsidemergeEnvVarsWithParams, mirroring howPUBLIC_CLERK_*vars already flow intoClerk.load().NUXT_PUBLIC_CLERK_*override convention picks it up; the existing...clerkConfigspread carries it through to the Vue plugin.getPublicEnvVariables/mergeWithPublicEnvs, the same path used for other client-readable vars (Vite exposesVITE_*to the browser bundle).getPublicEnvVariables, packs it into the SSRclerkStatepayload as__unsafeDisableDevelopmentModeConsoleWarning, and unpacks it inReactRouterClerkProvider.Test plan
pnpm turbo build --filter=@clerk/shared --filter=@clerk/astro --filter=@clerk/nuxt --filter=@clerk/tanstack-react-start --filter=@clerk/react-routerpassesPUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING=trueand confirm the console warning is suppressedNUXT_PUBLIC_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING=trueand confirm the warning is suppressedVITE_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING=trueand confirm the warning is suppressedVITE_CLERK_UNSAFE_DISABLE_DEVELOPMENT_MODE_CONSOLE_WARNING=trueand confirm the warning is suppressed<ClerkProvider unsafe_disableDevelopmentModeConsoleWarning />still works in each framework