Skip to content

TRAC-291 hide State/Province when the selected country has no states#3081

Open
mfaris9 wants to merge 3 commits into
canaryfrom
TRAC-291
Open

TRAC-291 hide State/Province when the selected country has no states#3081
mfaris9 wants to merge 3 commits into
canaryfrom
TRAC-291

Conversation

@mfaris9

@mfaris9 mfaris9 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Jira: TRAC-291

What/Why?

The Account Registration form validated State/Province as required even when the selected country has no states (Algeria, Monaco, etc.).

The register page now queries per-country state data from BigCommerce. When the shopper picks a country with no states, the State/Province field is hidden entirely and validation skips it. When the country does have states, the field stays visible and required.

Testing

Tested locally against an integration store:

  • Registration with country = Algeria (no states configured), State/Province field is hidden → registration succeeds
Screenshot 2026-07-07 at 11 21 32 AM
  • Registration with country = US, leave State/Province blank → error
  • Registration with country = US, fill State/Province → registration succeeds
Screenshot 2026-07-07 at 11 22 16 AM

Migration

None. No changes to server-side behavior or data model.

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Ready Ready Preview, Comment Jul 8, 2026 9:01pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 45b8257

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

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core 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

@mfaris9 mfaris9 changed the title fix(core): TRAC-291 treat stateOrProvince as optional in the form field transformer TRAC-291 treat stateOrProvince as optional in the form field transformer Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Report

Comparing against baseline from ce03afb (2026-07-08).

Metric Baseline Current Delta
Total JS 445 kB 445.5 kB +0.5 kB (+0.1%)

Per-Route First Load JS

Route Baseline Current Delta
/(default)/(auth)/register/page 367.5 kB 367.7 kB +0.2 kB (+0.1%)
/(default)/account/addresses/page 370.9 kB 371.1 kB +0.2 kB (+0.1%)
/(default)/account/settings/page 372.4 kB 372.6 kB +0.2 kB (+0.1%)

Threshold: 5% increase. Routes with ⚠️ exceed the threshold.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Unlighthouse Performance Comparison — Vercel

Comparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores.

Summary Score

Aggregate score across all categories as reported by Unlighthouse.

Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Score 90 93 92 94

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 75 86 74 68
Accessibility 95 92 95 98
Best Practices 100 100 100 100
SEO 88 100 100 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.7 s 4.2 s 3.9 s 5.5 s
CLS 0.04 0 0.05 0.222
FCP 1.2 s 1.1 s 1.2 s 1.2 s
TBT 0 ms 0 ms 20 ms 0 ms
Max Potential FID 50 ms 60 ms 60 ms 40 ms
Time to Interactive 3.7 s 4.4 s 6.0 s 5.6 s

Full Unlighthouse report →

@parthshahp

Copy link
Copy Markdown
Contributor

Is there no way to trigger a request or something to obtain this information after we select a country? I don't know if I like putting "Optional" text when it's not really optional.

Also, the error message has stateOrProvince inside of it in the video. Let's make sure to clean that up.

@mfaris9

mfaris9 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@parthshahp Yeah I don't love how its says optional when required for a country with states i'll update. I matched validation to cart. I can add a conditional render of the field, but it will require changes to the dynamic form and this would be the only field that would do this.

On your second point, I think thats out of scope since thats how all errors are being displayed. stateOrProvince comes from the backend and if we were to make this look better it would make sense to change all server error messages. If this is something you want I can make a separate ticket for it.

@mfaris9 mfaris9 changed the title TRAC-291 treat stateOrProvince as optional in the form field transformer TRAC-291 hide State/Province when the selected country has no states Jul 7, 2026
@mfaris9

mfaris9 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@parthshahp Ready for another review

@mfaris9 mfaris9 marked this pull request as ready for review July 8, 2026 13:44
@mfaris9 mfaris9 requested a review from a team as a code owner July 8, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants