Skip to content

Enhance FieldStore to Return Multiple Errors per Field #169

Open
@Toeler

Description

I'm currently working with Valibot and Modular Forms, where the Field component's children prop provides a FieldStore. This store includes an error: string property. However, this implementation seems limited as a field might have multiple validation errors, but FieldStore only returns the first error encountered.

This limitation requires additional logic on my end. To display all errors, I need to call getValues and then use safeParse from Valibot, which is not ideal for development experience. I initially thought getErrors could be a solution, but it also returns only the first error for each field.

For an improved DX, I propose enhancing FieldStore to include an errors: string[] | undefined property. This change would allow developers to easily access and display all relevant errors for a field.

Could this enhancement be considered for a future update?

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions