Pagination with infinite query...
Hey everyone... i'm thinking to use infinite query to retrieve data for a table with pagination... but probably is not the right choice because if i go back my pages result
grows up... what am I doing wrong?....
for example if i look this:
and i have 2 page... i will have this output...
step1: pages Array(1)
go forward: Array(2)
go back: Array(3) with the same result of step1
6 Replies
xenophobic-harlequin•15mo ago
is
go back
calling fetchPreviousPage()
?sensitive-blueOP•15mo ago
yes
if i go forward it work fine... but i go back the previus page is add to the pages array
maybe it has to work like this... that is, if I go back does it call the previous cursor or add it? I expected it to get the cached one
xenophobic-harlequin•15mo ago
fetchNext / fetchPrevious always adds, never reads from the cache
sensitive-blueOP•15mo ago
ahhh ok... so if i want use react-query to create a table with pagination probably i have to use useQuery and not useInfiniteQuery... is it right?
xenophobic-harlequin•15mo ago
yes, paginated queries where only one page at a time is displayed is not a use-case for infinite queries
sensitive-blueOP•15mo ago
Thank you