Skip to content

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

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

TRAC-291 hide State/Province when the selected country has no states#3081
mfaris9 wants to merge 8 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 15, 2026 5:34pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 332cd46

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 8256b46 (2026-07-15).

Metric Baseline Current Delta
Total JS 447.8 kB 448.3 kB +0.5 kB (+0.1%)

Per-Route First Load JS

Route Baseline Current Delta
/(default)/webpages/[id]/contact/page 369.1 kB 369.3 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 92 92 94

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 78 91 70 62
Accessibility 95 95 95 98
Best Practices 100 100 100 100
SEO 88 88 88 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.6 s 3.4 s 4.5 s 6.8 s
CLS 0.001 0 0.039 0.289
FCP 1.1 s 1.2 s 1.2 s 1.2 s
TBT 0 ms 0 ms 0 ms 20 ms
Max Potential FID 50 ms 50 ms 50 ms 70 ms
Time to Interactive 3.6 s 3.4 s 6.2 s 6.8 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

@rtalvarez rtalvarez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

any tests we can add for this?

@mfaris9

mfaris9 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@rtalvarez yes I can add. Would E2E be overkill? Can do unit test

@rtalvarez

Copy link
Copy Markdown
Member

@rtalvarez yes I can add. Would E2E be overkill? Can do unit test

Yeah id just do unit for this one

@mfaris9

mfaris9 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@rtalvarez Looks like we don't have the infrastructure for unit in catalyst. Would you prefer I build this out, do E2E or leave as is?

@mfaris9
mfaris9 enabled auto-merge July 14, 2026 14:42
@mfaris9
mfaris9 added this pull request to the merge queue Jul 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 14, 2026
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.

3 participants