Skip to content

fix(core): support required custom customer fields in Account Settings#3076

Open
chanceaclark wants to merge 1 commit into
canaryfrom
fix/account-settings-custom-fields-3074
Open

fix(core): support required custom customer fields in Account Settings#3076
chanceaclark wants to merge 1 commit into
canaryfrom
fix/account-settings-custom-fields-3074

Conversation

@chanceaclark

Copy link
Copy Markdown
Contributor

What/Why?

Fixes #3074.

The issue reports two problems with Account Settings' update-customer flow:

  1. Claimed the mutation only sends firstName/lastName, dropping email/company. This turned out to be a misread of the code — the lines cited are the mutation's response selection, not the input. submission.value (validated against updateAccountSchema) already includes email/company, and I confirmed via direct GraphQL calls against a test store that both persist correctly today. No fix needed for this part.
  2. Claimed that once a merchant adds a new required custom customer field, existing accounts have no way to satisfy it. This is real, and worse than described: I confirmed against a live store that BigCommerce revalidates every required custom customer field on every updateCustomer call — even fields that already have a stored value. A customer with a firstName-only edit gets ValidationError: Required account form field ID X is missing if that field isn't resent, regardless of whether it was previously set. Account Settings only ever submitted firstName/lastName/email/company, so any store with a required custom customer field (e.g. a "Terms and Conditions" checkbox added after accounts already existed) locked customers out of saving any change at all.

This is a regression: custom/dynamic form-field support existed in Account Settings since #1257 (Aug 2024) but was dropped during the Vibes migration (b14180c4, Dec 2024) and never restored, while Register and Address kept it via the newer DynamicForm/formFieldTransformer pattern.

This PR restores that support in Account Settings by reusing the same DynamicForm/formFieldTransformer pattern already used by Register and Address:

  • page-data.tsx now fetches the customer's existing custom form field values (customer.formFields) alongside the field definitions it already fetched but never used.
  • page.tsx filters out fields already covered by the fixed inputs (email, password, name, company, phone, newsletter checkbox) and transforms the rest into Fields, pre-filled with the customer's current values.
  • update-account-form.tsx renders those fields in the same form as the existing firstName/lastName/email/company inputs (via the shared DynamicFormField renderer), so a single save always resubmits the full required-field state — required given BigCommerce's per-call revalidation.
  • update-customer.ts builds the mutation's formFields input from whatever fields are present, following the same per-type mapping already used by registerCustomer/updateAddress.
  • Small supporting extraction in dynamic-form/schema.ts (getFieldsShape) so Account Settings' schema can merge the fixed fields with the dynamic ones without duplicating per-field-type zod logic.

Testing

  • Set up a test store with a required "Terms and Conditions" checkbox custom customer field, added after a test customer already existed.
  • Verified directly against the Storefront GraphQL API (bypassing the app) that:
    • email/company already persist correctly via the existing mutation input.
    • Omitting the required custom field from updateCustomer fails with ValidationError, even when the customer already has a stored value for it — confirming the bug and that the fix must always resend it.
  • Ran the app locally and rendered /account/settings with an authenticated session: confirmed the custom checkbox renders alongside the fixed fields, correctly prefilled from the customer's stored value (checked), and that email/company also prefill from live data.
  • pnpm run typecheck and pnpm run lint pass.
  • Not verified: an actual form submission through the browser (no browser automation available in this environment). The submit-side mutation shape was verified directly against the API in isolation and matches what the form now produces.

Migration

N/A — no breaking changes. updateAccountSchema changed from a ZodObject to a factory function; only relevant to direct importers of @/vibes/soul/sections/account-settings/schema.

BigCommerce revalidates required custom customer fields on every
updateCustomer call, even fields that already have a stored value.
Account Settings only ever submitted firstName/lastName/email/company,
so any store with a merchant-defined required custom customer field
(e.g. a Terms and Conditions checkbox added after accounts already
existed) locked customers out of saving any change at all.

This restores custom-field support (dropped in b14180c when the page
was migrated to Vibes) by reusing the existing DynamicForm/
formFieldTransformer pattern already used by Register and Address, so
required fields render, prefill from stored values, and get resent on
every save alongside the fixed fields.

Fixes #3074

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chanceaclark chanceaclark requested a review from a team as a code owner July 1, 2026 20:15
@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0519625

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

@vercel

vercel Bot commented Jul 1, 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 1, 2026 8:15pm

Request Review

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Report

Comparing against baseline from 81b88df (2026-07-01).

Metric Baseline Current Delta
Total JS 435.4 kB 435.8 kB +0.4 kB (+0.1%)

Per-Route First Load JS

Route Baseline Current Delta
/(default)/(auth)/change-password/page 318.8 kB 322.6 kB +3.8 kB (+1.2%)
/(default)/(auth)/login/forgot-password/page 318 kB 321.7 kB +3.7 kB (+1.2%)
/(default)/(auth)/login/page 318.4 kB 322.2 kB +3.8 kB (+1.2%)
/(default)/(auth)/register/page 354.6 kB 358.4 kB +3.8 kB (+1.1%)
/(default)/(faceted)/brand/[slug]/page 330.5 kB 334.2 kB +3.7 kB (+1.1%)
/(default)/(faceted)/category/[slug]/page 339 kB 342.8 kB +3.8 kB (+1.1%)
/(default)/(faceted)/search/page 330.5 kB 334.2 kB +3.7 kB (+1.1%)
/(default)/[...rest]/page 313.5 kB 317.3 kB +3.8 kB (+1.2%)
/(default)/account/addresses/page 358 kB 361.8 kB +3.8 kB (+1.1%)
/(default)/account/orders/[id]/page 321.6 kB 325.4 kB +3.8 kB (+1.2%)
/(default)/account/orders/page 322.6 kB 326.4 kB +3.8 kB (+1.2%)
/(default)/account/settings/page 329.2 kB 363.3 kB +34.1 kB (+10.4%) ⚠️
/(default)/account/wishlists/[id]/page 336.4 kB 340.1 kB +3.7 kB (+1.1%)
/(default)/account/wishlists/page 331.5 kB 335.2 kB +3.7 kB (+1.1%)
/(default)/blog/[blogId]/page 313.5 kB 317.3 kB +3.8 kB (+1.2%)
/(default)/blog/page 314.5 kB 318.3 kB +3.8 kB (+1.2%)
/(default)/cart/page 334.3 kB 338.1 kB +3.8 kB (+1.1%)
/(default)/compare/page 325.7 kB 329.4 kB +3.7 kB (+1.1%)
/(default)/gift-certificates/balance/page 317.5 kB 321.2 kB +3.7 kB (+1.2%)
/(default)/gift-certificates/page 313.5 kB 317.3 kB +3.8 kB (+1.2%)
/(default)/gift-certificates/purchase/page 357.1 kB 360.9 kB +3.8 kB (+1.1%)
/(default)/page 330.7 kB 334.4 kB +3.7 kB (+1.1%)
/(default)/product/[slug]/page 385.4 kB 389.2 kB +3.8 kB (+1%)
/(default)/webpages/[id]/contact/page 355.5 kB 359.3 kB +3.8 kB (+1.1%)
/(default)/webpages/[id]/normal/page 321.6 kB 325.4 kB +3.8 kB (+1.2%)
/(default)/wishlist/[token]/page 326.3 kB 330.1 kB +3.8 kB (+1.2%)

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

@chanceaclark

chanceaclark commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Proof:
Screenshot 2026-07-01 at 14 44 40

@github-actions

github-actions Bot commented Jul 1, 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 95

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 76 80 71 89
Accessibility 95 98 95 92
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.7 s 5.4 s 4.4 s 3.6 s
CLS 0.001 0 0.037 0
FCP 1.2 s 1.2 s 1.2 s 1.1 s
TBT 0 ms 0 ms 40 ms 0 ms
Max Potential FID 60 ms 50 ms 90 ms 50 ms
Time to Interactive 3.7 s 5.4 s 6.1 s 3.7 s

Full Unlighthouse report →

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.

Update customer missing fields

1 participant