T
TanStack15mo ago
tame-yellow

cancelQueries does not seem to cancel trpc fetches

try {
queryClient.cancelQueries({ exact: false, stale: false, fetchStatus: 'fetching'});
} catch (error) {
console.log("Cancelled the queries");
}
const ac = new AbortController();

return utils.todoUser.findByName.fetch(
{ spaceName },
{
signal: ac.signal
// staleTime: 1000 * 60, //1 minute
// queryKey: [spaceName],
}
);
try {
queryClient.cancelQueries({ exact: false, stale: false, fetchStatus: 'fetching'});
} catch (error) {
console.log("Cancelled the queries");
}
const ac = new AbortController();

return utils.todoUser.findByName.fetch(
{ spaceName },
{
signal: ac.signal
// staleTime: 1000 * 60, //1 minute
// queryKey: [spaceName],
}
);
the above fetches todoUser by name (unique presence validation) as adebounced callback, but the cancelQueries does not seem to cancel the past findByName fetches. Is there anything that I am doing wrong ?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?