-
It appears that when I use the trigger function returned from a LazyQuery, it always initiates a new request to the server even if there is cached data. Is this to be expected? I would expect the trigger function to return cached data when called with the same args as a previous trigger. If not, how do I access the cached data? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 13 replies
-
Huh, this is actually undocumented and... not even in the TS types? To answer your question, the real signature of the function (arg: any, preferCacheValue = false) { so you can decide if it should use the cache with the second argument. We need to get this in the docs and types though. Thanks for pointing it out. |
Beta Was this translation helpful? Give feedback.
-
@phryneas I'd like to contribute to this. I'm new to this repo so would appreciate some guidance. According to the changes highlighted by you and @kjg, I think the changes should be made in this section:
Thanks a lot for reading, looking forward to your reply! |
Beta Was this translation helpful? Give feedback.
-
You can find that type here. Adding to the comment above it will also end up in the documentation. redux-toolkit/packages/toolkit/src/query/react/buildHooks.ts Lines 183 to 191 in 9e772d2 Right now, there are two options to handle this:
|
Beta Was this translation helpful? Give feedback.
-
@markerikson and @phryneas I've filed the PR 👍 |
Beta Was this translation helpful? Give feedback.
-
Hey guys, just came up with the issue here. I would like to know the current status of this thread, and if there's something to do about it. As I've seen, the doc has been updated and it now has a note about the |
Beta Was this translation helpful? Give feedback.
-
not sure why i still not get the types in the latest version |
Beta Was this translation helpful? Give feedback.
Huh, this is actually undocumented and... not even in the TS types?
To answer your question, the real signature of the
trigger
function isso you can decide if it should use the cache with the second argument.
We need to get this in the docs and types though. Thanks for pointing it out.