Skip to content
Discussion options

You must be logged in to vote

when you see: data is undefined, that means the queryFn has returned undefined. In dev mode, you should see this additional console error:

Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ["userReplyData","MakeAudio","[email protected]"]

looking at your getUserReplyData function, you return undefined implicitly here:

  if (error) {
    console.error(`Error getting user replies data: ${error.message}`)
    return
  }

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 (because return is really r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sundaray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants