Closed
Description
Describe the bug
I would want to launch a query using the "enabled" property in the useQuery
const periodSelected = ref<string>();
const { result } = useQuery(REPORT, () => ({}), () => ({
fetchPolicy: 'no-cache',
enabled: !!periodSelected.value,
}));
By default the result of !!periodSelected.value
is false
. But the query is launched.
If I try to use a static false
const { result } = useQuery(REPORT, () => ({}), () => ({
fetchPolicy: 'no-cache',
enabled: false,
}));
It works.
Versions
vue: 3.2.41
vue-apollo: 3.1.0
@apollo/client: 3.7.1
Additional context
I've tried with computed options:
const { result } = useQuery(REPORT, () => ({}), computed(() => ({
fetchPolicy: 'no-cache',
enabled: !!periodSelected.value,
})));
Not working.