fix(astro): avoid invalid ui constructor in injected scripts#8628
fix(astro): avoid invalid ui constructor in injected scripts#8628jescalan wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 50d8e7d 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 GitHub.
|
|
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 (5)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR adds a helper that serializes internal initialization params and, when Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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: |
03636db to
50d8e7d
Compare
Summary
Fix two Astro integration initialization paths that could pass an invalid
ui.ClerkUIvalue intoclerk.load():The bundled UI path was serializing injected script params with
JSON.stringify(...), which stripsui.ClerkUIbecause it is a constructor. The client-side initialization then sawoptions.ui, skipped CDN UI loading, and passed an object without a usableClerkUIconstructor intoclerk.load().The
prefetchUI: falsepath had a related issue: Astro returnedPromise<undefined>from the UI resolver, then passed that promise asui.ClerkUI.clerk-jstreats the promise object as truthy and later attempts to instantiate the resolvedundefinedvalue.This PR now:
uiobject from@clerk/uiin injected snippets when the Astro integration is configured withuiundefined, notPromise<undefined>, for no-UI paths likeprefetchUI: falseand UI marker objects without constructorsTesting
pnpm --filter @clerk/astro test -- src/internal/__tests__/create-clerk-instance.test.ts src/integration/__tests__/snippets.test.tspnpm --filter @clerk/astro lint(passes with existing warnings)pnpm exec prettier --check packages/astro/src/internal/create-clerk-instance.ts packages/astro/src/internal/__tests__/create-clerk-instance.test.ts packages/astro/src/integration/snippets.ts packages/astro/src/integration/__tests__/snippets.test.ts .changeset/astro-bundled-ui-serialization.mdgit diff --checkNote:
pnpm --filter @clerk/astro format:checkstill fails on pre-existing copiedcomponents/**/*.astroformatting issues, but it does not flag the files touched in this PR.