You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The generated ensureQueryData.ts specifies Options<T, true>, which restricts the value of throwOnError to true or undefined and assumes that the query never fails.
However the default value of throwOnError is false, so in code currently generated by this tool, if it's not explicitly set by the user, causes both type (the function returns undefined while it's not meant to) and runtime (Query data cannot be undefined. Please make sure to return a value other than undefined from your query function) issues.
Describe the bug
The generated
ensureQueryData.ts
specifiesOptions<T, true>
, which restricts the value ofthrowOnError
totrue
orundefined
and assumes that the query never fails.However the default value of
throwOnError
is false, so in code currently generated by this tool, if it's not explicitly set by the user, causes both type (the function returnsundefined
while it's not meant to) and runtime (Query data cannot be undefined. Please make sure to return a value other than undefined from your query function
) issues.Potentially related to #148
To Reproduce
Generate the query code from any API schema and try to use any of the
ensure*
functions.Expected behavior
I think that
ensure*
functions should always throw an error.Returning
undefined
is not supported by react-query and does not let you properly handle the failed query.The text was updated successfully, but these errors were encountered: