You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a message feed where i use useInfiniteQuery to make the first request and infinite pagination.
However, when receive a new message socket, i need to update the react query with this new message. To do this, i'm using queryClient.setQueryData informing the key of my query and its value [FETCH_INFINITE_INTERACTIONS_KEY, channelSelected?.id].
Everything works great on "normal" pages. The problem is when i need to add the feed component on a page that has parameters in the URL. Only when this page has parameters is data returning undefined.
The request is made normally, the messages are listed, but when i receive a new message socket and i update the react query, the data is undefined.
If I take all the URL parameters and leave only the page name (pathname), the data returns the array of pages normally.
I don't understand what one thing has to do with the other?!
Code fragment:
queryClient.setQueryData([FETCH_STORE_INFINITE_INTERACTIONS_KEY,channelSelected?.id],data=>console.log('data',data),// this data <--);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Tec libs version
react-query: 3.12.0
next: 10.0.7
react: 17.0.1
react-dom: 17.0.1
The Scenario
Hey guys!
I have a message feed where i use useInfiniteQuery to make the first request and infinite pagination.
However, when receive a new message socket, i need to update the react query with this new message. To do this, i'm using
queryClient.setQueryData
informing the key of my query and its value[FETCH_INFINITE_INTERACTIONS_KEY, channelSelected?.id]
.Query hook function:
Socket listener:
The Problem
Everything works great on "normal" pages. The problem is when i need to add the feed component on a page that has parameters in the URL. Only when this page has parameters is data returning
undefined
.The request is made normally, the messages are listed, but when i receive a new message socket and i update the react query, the data is undefined.
If I take all the URL parameters and leave only the page name (pathname), the data returns the array of pages normally.
I don't understand what one thing has to do with the other?!
Code fragment:
Example with URL parameters:
URL: http://localhost:3000/en/trading?argumentA=12345&argumentB=12345
console.log('data', data)
:undefined
Example without parameters in the URL:
URL: http://localhost:3000/en/trading
console.log('data', data)
:Beta Was this translation helpful? Give feedback.
All reactions