Throw Error in Selector
I'm applying parser in my
I'm using zod to catch the errors and the parser function does throw error. Now, I would like to tell react query that there's something wrong when doing data transformation in
How to let react query knows that something wrong is happening?
I want the react query treat the error just like any API call error (rejected). Thus triggerin global onError function.
OR
do you think it's not the correct place to put the parser? Do I have to use it in my API function, the query function?
select function, bascially to ensure I have the correct data types from the server and transform the API response into an object that the type is defined by me. I'm using zod to catch the errors and the parser function does throw error. Now, I would like to tell react query that there's something wrong when doing data transformation in
select function. But it does nothing. How to let react query knows that something wrong is happening?
I want the react query treat the error just like any API call error (rejected). Thus triggerin global onError function.
OR
do you think it's not the correct place to put the parser? Do I have to use it in my API function, the query function?