-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
How useInfiteQuery hook was designed to function is that when getFetchMore queries for data and nextCursor/nextId/nexPage/cursor (or whatever the name you give) returns a falsy value or no value at all then the function (getFetchMore) should abort querying for next data otherwise we'll start from beginning which will cause unwanted duplication. However, that's not the case. getFetchMore disregards the falsy value and goes ahead to query data. So we end up with a query like for example:- /api/projects?cursor=null which returns duplicate data.
To Reproduce
Steps to reproduce the behavior:
- Run load-more-infinite-scroll example from react-query's examples directory
- I'm running v2.5.1 of react-query but the bug should suffice in v2 and above
Expected behavior
useInfinteQuery should abort fetching data when nextId/nexCursor/nextPage is null
Additional context
If it's not a bug then maybe the implementation changed a great deal that we are not aware of