Cache data between infinite query and sockets events #3649
Unanswered
tiagocorreiaalmeida
asked this question in
Q&A
Replies: 2 comments
-
does this help? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm currently on the same issue. I think the easiest way would be to write new messages from the subscription to data.pages[0]. @TkDodo please correct me if there is a better way. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I'm trying to implement a mix of sockets and promised based calls into the same cache key.
Take for a example a chat channel, where once I enter it I need to call useInfiniteQuery() to get the latest 10 messages and as I scroll up I load more messages, other than loading the initial data trough a promise request I need to listen to events of messages being added, removed or updated.
My idea was to update the infinite query cache as those events come in but it becomes difficult and "expensive" to do so since the cache data of useInfinite query is stored as an array of arrays(data.pages[x]), any idea of what I could do in here?
If this is not something that react query is intend to support I will have to find other way to get there, thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions