Valibot resolver doesn't collect rawCheck issues when base schema fails #13265
Unanswered
stefan-girlich
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I ran into an issue where validation errors from
v.rawCheckweren't showing up in my formuntil all other fields were valid first. Once they became valid once, errors would show
correctly even after making those fields invalid again.
Environment
Root issue
When using
v.rawCheckfor custom validation logic, issues I add viaaddIssue()don't appearin the form errors if the base schema validation fails (
dataset.typed === false).The resolver uses
safeParseAsyncwhich doesn't seem to include rawCheck issues when theschema isn't fully "typed":
Workaround
Switching to a custom resolver with parse/parseAsync (which throws a ValiError) that collects all issues from the
pipeline, including rawCheck issues regardless of dataset.typed:
I lack the experience with react-hook-form resolvers and valibot to tell what the expected behavior should be.
Happy to submit a PR if this should be fixed in the resolver.
Full valibotResolver.ts code with workaround
Beta Was this translation helpful? Give feedback.
All reactions