RTK Query: results from different query arguments returned on error #3349
-
Hello everyone 🖖 The issue appears when the endpoint returns an error: while the status correctly is being set to "rejected" the data from the previous query, which was performed with different query arguments, is shown. You can see the issue reproduced on this codesandbox: if you click on "set error" button you'll see that while the query has changed argument, the data from the previous one is still shown. I played with several combinations of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
see Frequently Used Query Hook Return Values for the difference between
you can see that your sandbox behaves the way you expected when using |
Beta Was this translation helpful? Give feedback.
see Frequently Used Query Hook Return Values for the difference between
data
andcurrentData
:data
- The latest returned result regardless of hook arg, if present.currentData
- The latest returned result for the current hook arg, if present.you can see that your sandbox behaves the way you expected when using
currentData
.