Skip to content

[frontend] Surface form-level Zod issues and remove unused settingsFormSchema - #1707

Open
CathyZaks wants to merge 2 commits into
Junirezz:mainfrom
CathyZaks:fix/issue-1623-frontend-surface-form-level-zod-issues-a
Open

CathyZaks wants to merge 2 commits into
Junirezz:mainfrom
CathyZaks:fix/issue-1623-frontend-surface-form-level-zod-issues-a

Conversation

@CathyZaks

Copy link
Copy Markdown
Contributor

Surface form-level Zod issues under _form

Problem

zodValidate only mapped issue.path[0] and dropped empty-path issues (object-level .refine), and if (fieldName && ...) dropped falsy keys. settingsFormSchema had no production consumer, and useZodForm.test.ts tested useForm.

Solution

Empty-path issues are reported under reserved key _form; a shared FormErrors component renders it. The unused settings schema and its misnamed test are removed; tests now live in zodValidate.test.ts.

Changes

  • forms/zodValidate.ts: FORM_ERROR_KEY, FormErrors type, empty path -> _form, no falsy-key drop.
  • forms/useForm.ts: errors typed with _form; _form is kept when filtering by touched fields.
  • forms/components/FormErrors.tsx: shared renderer (role="alert"); exported from forms/index.ts.
  • Removed schemas/settingsFormSchema.ts and useZodForm.test.ts.

Regression Tests

Acceptance criterion Test
Form-level issues under _form zodValidate.test.ts, useForm.test.tsx
Rendered by shared component components/FormErrors.test.tsx
Schema/test removed, file renamed zodValidate.test.ts replaces useZodForm.test.ts
Index 0 path zodValidate.test.ts (array schema)

Testing

npx vitest run: Test Files 136 passed, Tests 1426 passed (before adding new tests); npx vitest run src/forms: 9 files, 108 tests passed. tsc clean, npm run lint: 0 errors, npm run build: built.

Notes for Reviewers

Removal chosen over wiring the schema into Settings.tsx (out of scope). FormErrors is not yet mounted in a production form since none uses object-level refines today.

Closes #1623

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@CathyZaks Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

This branch has not been deployed

No deployments
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.

[frontend] Surface form-level Zod issues and resolve unused settingsFormSchema

1 participant