Question on retry behavior for infinite query refetch #8044
Replies: 2 comments 1 reply
-
thanks for reporting this. It's definitely a bug, and a serious one too. I've looked into it and I know why it's happening, but not yet sure how to fix it. Can you file an issue please? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks for the quick turnaround here. Verified the expected behavior in v5.56.1 https://codesandbox.io/p/sandbox/tanstack-query-sandbox-forked-x77pyy. |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey! I'm having a hard time find an existing question on this specific scenario so hoping to get some clarity and guidance with this discussion.
I am using
useInfiniteQuery
to additively load more data into a table from anextToken
based list API (e.g. example AWS SDK list API). Requesting next pages and refetching works great for the most part, but I'm having some trouble figuring out a way to preserve the next page param for a retried request triggered by a manual or automatedrefetch
.When fetching next pages with
fetchNextPage
and thequeryFn
rejects with an error response, the request is retried as expected using the same page params. However, I noticed retried requests from a manual or automatedrefetch
will start over back to the first page after the first error response is encountered. I understand the need to fetch sequentially from the first page for the refetch, however, I would expect the failed request to retry using the same page params and continue onto the next page request once a retry succeeds.The backend service I'm working with has a reasonable rate limit set (50 TPM in a 1 minute sliding window), but I'm trying to ensure a manual or automatic
refetch
will be able to recover from worst-case rate limiting scenarios where the user can continuously rate-limit themselves by refetching a table view loaded with 50+ pages.I've put together a code sandbox with a mock API to demonstrate the page param reset behavior for retried refetch requests: https://codesandbox.io/p/sandbox/mqvdz4
Console log of requests:
Thanks in advance for the help here! Please let me know if I need to add any more detail to this message.
Beta Was this translation helpful? Give feedback.
All reactions