-
Is there a way to prevent a query from returning cached data when I'm passing skipToken as the arg? In my case, between selected items, a parameter changes from Ie, in the following example, if routeParams.code is A, then code changes to undefined, then code changes to B, while the data for B is fetching, data will contain the data for A. const { data } =
useGetItemByCodeQuery(
routeParams.code
? {
code: routeParams.code,
}
: skipToken
);
console.log(routeParams.code, data);
// a, {code: a}
// undefined, {code: a}
// b, {code: a}
// b, {code: b} A potential workaround is utilizing the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Not at the moment. You can only do something like const arg = routeParams.code ? { code: routeParams.code } : skipToken
const { data } = useGetItemByCodeQuery(arg);
const myData = arg == skipToken ? undefined : data |
Beta Was this translation helpful? Give feedback.
Not at the moment. You can only do something like