Error handling with fakeBaseQuery (RTK Query streaming updates) #4993
-
What is the recommended way of handling errors while using streaming updates? |
Beta Was this translation helpful? Give feedback.
Answered by
markerikson
May 21, 2025
Replies: 2 comments 3 replies
This comment was marked as spam.
This comment was marked as spam.
-
Somebody asked about it two years earlier: #2434 |
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
The short answer is that RTK Query is meant to track the status of a promise and cache its result. The lifecycle methods let you kick off additional side effect logic, but essentially anything you do in there is then outside the scope of RTK Query's cache entry.
So, while RTKQ gives you space to write additional logic, any status you would want to track regarding some external connection would need to be handled separately yourself.
Beyond that, we don't currently have a way to force a cache entry to have an errored status.
(for the OP's specific mention of
updateCachedData
, I'm not sure how that factors in here as far as errors.)