How to keep error state with placeholderData
from useQuery
?
#7629
Unanswered
park-jemin
asked this question in
Q&A
Replies: 1 comment
-
I don't think its possible to keep the error. You can implement |
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.
-
I'm using
placeholderData
to maintain the previous data when transitioning between pages, which defaults it to a success state. However, when I hit an error from a fetch call, I would like to keep the error state instead of keeping the previous data when I transition, until the next time I hit a successful fetch or cache hit.The flow I'm running into rn looks kinda like this:
useQuery
withpage = 1
, returns a successful responseuseQuery
withpage = 2
, returns a successful response while temporarily using the previous page data as a placeholderuseQuery
withpage = 3
, returns an error response (withisError = true
) while temporarily using the previous page data as a placeholderuseQuery
withpage = 4
, returns an error response, but temporarily flashes the page 2 data as a placeholder (withisError
temporarily being set totrue
)How should I go about approaching this?
Beta Was this translation helpful? Give feedback.
All reactions