Skip to content

fix(clerk-js): Correct locale inconsistencies when creating SignUpFuture#8762

Merged
wobsoriano merged 3 commits into
mainfrom
fix/signup-future-password-locale
Jun 5, 2026
Merged

fix(clerk-js): Correct locale inconsistencies when creating SignUpFuture#8762
wobsoriano merged 3 commits into
mainfrom
fix/signup-future-password-locale

Conversation

@dmoerner
Copy link
Copy Markdown
Contributor

@dmoerner dmoerner commented Jun 5, 2026

Description

We have five different ways to create a SignUp with SignUpFuture and they have inconsistent handling of params and the browser locale:

  • create: Uses a param or browser fallback to set locale.
  • password: This does not apply the browser-locale fallback but does use the param. Fixed in this PR to use the fallback only on POST.
  • web3: This delegates to _create but did not pass along locale or first or last name, meaning that it always got the fallback behavior. Fixed in this PR to pass all three params.
  • ticket: Handles correctly
  • sso: This doesn't apply any locale at all. (It also doesn't take first and last name but since we generally get this from the SSO provider I didn't include it.)

These changes now align our API with the contract in our types SignUpFutureAdditionalParams which lists locale as a parameter and says we will fall back to the browser's locale.

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

    • signUp.password() and signUp.sso() now default to the browser locale when creating new sign-ups, matching signUp.create().
    • Explicitly provided locale values are preserved.
    • signUp.web3() now forwards firstName, lastName, and locale when creating a sign-up.
  • Tests

    • Added coverage verifying locale behavior across create vs. update flows and web3 parameter forwarding.

dmoerner and others added 2 commits June 5, 2026 08:56
When password() created a new sign-up (no existing sign-up id), it did
not apply the browser-locale fallback that create() applies, so the
sign-up was created without a locale unless one was passed explicitly.
Inject the fallback on the create path only, so updating an existing
sign-up does not overwrite a previously set locale.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

🦋 Changeset detected

Latest commit: 02821cc

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

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/expo 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
Copy Markdown

vercel Bot commented Jun 5, 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 Jun 5, 2026 2:32pm

Request Review

@dmoerner dmoerner changed the title fix(clerk-js): Correct locale inconsitencies when creating SignUpFuture fix(clerk-js): Correct locale inconsistencies when creating SignUpFuture Jun 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: ca6d914b-ff31-4734-ad98-08a9dd517563

📥 Commits

Reviewing files that changed from the base of the PR and between d3945a7 and 02821cc.

📒 Files selected for processing (1)
  • packages/clerk-js/bundlewatch.config.json
✅ Files skipped from review due to trivial changes (1)
  • packages/clerk-js/bundlewatch.config.json

📝 Walkthrough

Walkthrough

This PR fixes locale handling in the SignUpFuture API. The password and sso flows now inject the browser's locale only when creating a new sign-up, not during subsequent updates. The web3 flow now forwards firstName, lastName, and locale parameters to the created sign-up. Tests verify the locale injection behavior and parameter forwarding.

Changes

SignUp Future API locale and parameter handling

Layer / File(s) Summary
Password flow locale injection
packages/clerk-js/src/core/resources/SignUp.ts, packages/clerk-js/src/core/resources/__tests__/SignUp.test.ts
The password flow conditionally injects browser locale into the request body only when creating a new sign-up, preventing locale from being overwritten during updates. Tests verify locale is injected on create, can be overridden explicitly, and is not injected when updating an existing sign-up.
SSO flow locale handling
packages/clerk-js/src/core/resources/SignUp.ts, packages/clerk-js/src/core/resources/__tests__/SignUp.test.ts
The sso flow extracts locale from parameters and conditionally includes it in the authentication request only during new sign-up creation. Tests confirm browser locale is injected for new signups, explicit locale takes precedence, and existing signup locale remains unchanged during patching.
Web3 flow parameter forwarding
packages/clerk-js/src/core/resources/SignUp.ts, packages/clerk-js/src/core/resources/__tests__/SignUp.test.ts
The web3 flow now accepts and forwards locale, firstName, and lastName parameters to the sign-up creation call instead of discarding them. Tests verify these parameters are included in the request body.
Changeset documentation
.changeset/signup-future-password-browser-locale.md
Documents the patch-level fixes to the SignUpFuture API locale and parameter handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • clerk/javascript#8558: Both PRs modify SignUpFuture in SignUp.ts, where this PR adjusts locale handling in password/sso/web3 flows and the related PR fixes SSO/update resource URL patching.

Suggested reviewers

  • wobsoriano
  • dstaley

Poem

🐰 A sign-up locale journey,
Where browser whispers its tongue—
Create it fresh, inject it with grace,
Update it gently, leave it in place,
And web3 now carries its family along! 🌍✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: correcting locale inconsistencies in SignUpFuture creation methods to ensure consistent behavior across password, web3, and sso flows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.


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 Jun 5, 2026

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 02821cc

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Break Check: no API changes detected across the tracked packages.

Last ran on 02821cc. Pushes that change no tracked declarations (no API surface change vs. base) are skipped and don't update this comment.

Copy link
Copy Markdown
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

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

ahh this makes sense! thanks for adding

@dmoerner
Copy link
Copy Markdown
Contributor Author

dmoerner commented Jun 5, 2026

Thanks @wobsoriano for the approval, and thanks to Support Rotation for leading me to look into this code for a customer 👍

@wobsoriano wobsoriano merged commit eb5c02d into main Jun 5, 2026
48 checks passed
@wobsoriano wobsoriano deleted the fix/signup-future-password-locale branch June 5, 2026 16:04
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