Description
openedon Nov 3, 2022
Hey!
I already shortly commented about this issue here: #1354 but decided to do a separate issue because that seemed to be a bit old, inactive and without a reproduction it doesn't really add too much value. So I went ahead and did a reproduction of the issue here: https://github.com/akselikap/rtk-query-ssr-error-demo.
The demo is a 100% Node.js app because that's all it takes to demo the issue. It's missing webpack configs and hydration so the client won't work but it's enough to demonstrate the issue with forced retries on mount. Essentially what happens is that the state is left in a broken state and if it were transferred back to the browser it would just be endlessly stuck in the "pending" state.
The refetchOnError
option suggested in the discussion would fix the issue for me. If you have any idea how to get around this issue with currently available methods I'm eager to hear about those as well. Also if you have any suggestions how to do the "dependency injection" in a more beautiful way without using a DI library I would be grateful for that as well.