Replies: 3 comments 4 replies
-
We've clarified here why this change was made:
yep, we tried that, but it's harder to do than it looks :) |
Beta Was this translation helpful? Give feedback.
4 replies
-
this is dumb |
Beta Was this translation helpful? Give feedback.
0 replies
-
this is dumb |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm upgrading from v3 to v4 and I get this error on tests that rely on returning
undefined
fromuseQuery
."Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key ..."
Here's a link to the line of code:
query/packages/query-core/src/query.ts
Line 457 in 1614c31
And this is some code of how I was using it:
Now I've resorted to using
useQuery<ResponseType | null>
instead and then usingdata
likedata ?? undefined
.Also, this should make TS fail by not allowing
undefined
as a possible useQuery type, instead of throwing console errors on dev environment.What was the reason for adding this change? I couldn't find any info on why this check is necessary.
Beta Was this translation helpful? Give feedback.
All reactions