Replies: 1 comment 2 replies
-
not that I know of. We do have this information though because we are computing query/packages/query-core/src/infiniteQueryObserver.ts Lines 151 to 156 in 357ec04 question is: what would be a good way to expose it 🤔 |
Beta Was this translation helpful? Give feedback.
2 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.
-
When you're using a bi-directional
useInfiniteQuery
, and an error occurs while fetching, is there any way to know whether that error was caused byfetchPreviousPage
orfetchNextPage
(or neither in case of initial load)?For example, I'm using 'previous' and 'next' buttons to fetch the previous or next page, and would like to hide the 'previous' button when an error occured while fetching the previous page (but not the 'next' button).
One of my ideas was to give an extra argument to
fetchNextPage
orfetchPreviousPage
, to tell the query function which of these was used so it can throw a custom error. But I was wondering if there was a simpler way. In addition, I'm not sure how to add extra arguments to these without overwriting thepageParam
.My current code looks something like this, calling
fetchNextPage
andfetchPreviousPage
on the buttons.Thank you! 🙏
Beta Was this translation helpful? Give feedback.
All reactions