Open
Description
Hi! Thank you for your work on Villus. I made the switch recently and I'm delighted!
I just noticed that if I have a paused query, with a reactive pause depending on a reactive variable, like
const count = ref(0);
const GetTodos = `
GetTodos ($count: Int!) {
todos {
id
title
}
}
`;
const { data } = useQuery({
query: GetTodos,
variables: ref({ count }),
paused: () => count.value === 0,
});
then when the value of the variable is update so that paused.value
becomes false
, the query is fired twice (I guess the update of variables
and of paused
both trigger a refetch, or there might be some race condition). This also happens using paused: ({ count }) => count === 0
.
Here is a MWE (click on the button and check the console logs): https://stackblitz.com/edit/vitejs-vite-xejziegs?file=src%2Fcomponents%2FHelloWorld.vue
I do not know if this behavior is expected (it is not a big deal in my case, because the second fetch uses the cache).
Metadata
Metadata
Assignees
Labels
No labels