Replies: 2 comments 1 reply
-
Code example for the workaround:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@tannerlinsley - Would be happy to hear your thoughts on this matter. 🙏 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The general
isError
boolean does not indicate on which operation the fetch has failed. The original fetch, the previous page fetch, or the next page fetch.Indicating which operation resulted in error is very important UX wise. For example, taking a generic infinite scrolled chat as an example.
When loading the initial data, we will want to display some error state on the entire chat box and a retry button.
When loading previous messages we will want to display a "Failed to load. Press here to retry" message on the top of the infinite scroll.
When loading new messages we will want to display a "Failed to load. Press here to retry" message on the bottom of the infinite scroll.
The only solution right now is to copy the
isFetchingPreviousPage
andisFetchingNextPage
to state, clean it on success, and add error booleans that will turn on if the consumer's copied isFetching is true and we receive an error.I think this kind of functionality should be part of the api of this query, in whicever way makes sense to you.
E.g -
onError
can receive a second parameter that indicates the operation + adding aisFetchNextPageError/isErrorFetchingNextPage
andisFetchPreviousPageError/isErrorFetchingPreviousPage
booleans.WDYT?
Beta Was this translation helpful? Give feedback.
All reactions