-
Is it possible to use useSubscription for react query's infinite query? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi Rayhan, It is not implemented atm. I've had a look into the react query source code and technically speaking it should be pretty straightforward to add something like useInfiniteSubscription hook into this library. What is more complicated is to decide the hook api so it makes sense. One of the things which we need to be aware off when working with real-time data is, that the cursor might have changed between fetching the last page and the page we are about to fetch. This can happen, for example, when due to real-time update there has been a new item inserted into the collection in the current query. Could you please maybe clarify/suggest the use case, so that we can go from there. Until implemented, you could work around this by implementing the pagination manually. |
Beta Was this translation helpful? Give feedback.
-
This is my implementation of this whole process.
|
Beta Was this translation helpful? Give feedback.
This is my implementation of this whole process.