vue-query-nuxt icon indicating copy to clipboard operation
vue-query-nuxt copied to clipboard

Cannot seem to trigger a client validation error using Valibot/Zod

Open agenordebriat opened this issue 1 year ago • 0 comments
trafficstars

Environment

  • Nuxt 3.8.2
  • vue-query-nuxt 0.3.0
  • Tried w/ latest Node/Bun versions

Reproduction

StackBlitz reproduction

What I'm currently trying to achieve is display an error page on validation error, since, as you can see, my PostsSchema is waiting for the body to be a number, purely for testing purposes of course.

It only works when I await suspense() at the end of my script setup, or if I try/catch the parse from Valibot (same thing happens with parse from Zod) and throw a showError. createError with fatal: true is also not an option for some reason I'm not getting.

I recon I must be misunderstanding some things along the way.

Describe the bug

Shouldn't my return parse(PostsSchema, response) trigger an error, then the queryFn should do something so I'm not left with a blank page and no error feedback at all?

Additional context

No response

Logs

No response

agenordebriat avatar Dec 25 '23 11:12 agenordebriat