Skip to content
Discussion options

You must be logged in to vote

The gotcha is that your mutation function doesn't return anything:

{message}) => {
    if (state.originalMessageId) {
      replyByMessageId(state.originalMessageId, message)
    } else { 
      chatMessage(message)
    }
  }

if a function doesn't return anything, it returns undefined implicitly, which is what you'll then get. So you need to return the Promise from your data fetching function to react-query for it to work.

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@LXDamm
Comment options

@LXDamm
Comment options

@Asinging
Comment options

Answer selected by LXDamm
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@louis-young
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants