-
I am working on a Next.js application where I have implemented a commenting system. Users can post a review for a particular AI tool, reply to a review, and reply to a reply as well. I have a component named
Here is the query code that fetches the data (an object with two keys:
And here is the code for the
The When I am NOT logged in, the
I suspect this error is related to the query key that I have set inside the query. Here is the query key for reference:
So, why am I getting this error when I am logged in? Is it because the Additional Information: Any help or insights would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
when you see:
looking at your
what you need to do is throw an error or return a rejected Promise to react-query to go into error state. Otherwise, it will be in success state with |
Beta Was this translation helpful? Give feedback.
when you see:
data is undefined
, that means thequeryFn
has returnedundefined
. In dev mode, you should see this additional console error:looking at your
getUserReplyData
function, you return undefined implicitly here:what you need to do is throw an error or return a rejected Promise to react-query to go into error state. Otherwise, it will be in success state with
undefined
data (becausereturn
is reallyr…