Cache contains duplicate data somehow
I have a useQuery like this:
Which fetches a list for messages for the given
dmID. The response will look like this:
In the UI, I am editing the message with the id 2. That will send a websocket event to the server. That server will broadcast the event to all clients with this payload:
I capture this event and trying to invalidate the query using setQueryData like this:
The problem is that data contains duplicate ids. Like this:
Don't know how. The first element id value should be 1 in cache right?2 Replies
like-gold•3y ago
must be an error somewhere in your setQueryData call
correct-apricotOP•3y ago
I am using setQueryData in only one place. Also I am using next.js.