Skip to content

fix(client): blank optional AutoForm fields no longer force a password - #54

Merged
YonatanHen merged 1 commit into
stagingfrom
dev/account-form-blank-optional-fields
Aug 1, 2026
Merged

fix(client): blank optional AutoForm fields no longer force a password#54
YonatanHen merged 1 commit into
stagingfrom
dev/account-form-blank-optional-fields

Conversation

@YonatanHen

Copy link
Copy Markdown
Owner

Summary

  • AutoForm submitted every field's raw string, so an untouched optional field (e.g. AccountPage's "set a password" box) sent '' instead of undefined.
  • Zod's .optional() only skips validation on undefined, so '' still hit PasswordSchema.min(8) and blocked every account save — bio-only edits included — behind a password field. Worse for Google OAuth accounts, which have no password to enter at all.
  • Fix: a blank optional text/textarea/password field is now submitted as undefined, not ''.

Test plan

  • npm run test -- apps/client/src/components/patterns/AutoForm.test.tsx — added a regression test for the exact bug
  • npm run test — full suite, 476 passing

AutoForm always submitted every field's raw string value, so an untouched
optional field like AccountPage's "set a password" box sent '' rather than
undefined. Zod's PasswordSchema.optional() only skips validation on
undefined, so '' still hit min(8) and blocked every account save (bio-only
edits included) behind a password the user never asked to set — worse for
Google OAuth accounts, which have no password to type at all.
@YonatanHen
YonatanHen merged commit 20eceaf into staging Aug 1, 2026
5 checks passed
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.

1 participant