queryOptions.enabled

I am using Hasura/GraphQL with Ant Design and my hooks appear to still run queries even if queryOptions.enabled is hard-coded to false
const { refetch: refetchManufacturers } = useList<IManufacturer>({
resource: "manufacturer",
config: {
filters: [{ field: "name", operator: "contains", value: `${value}%` }],
},
metaData: {
name: "ListManufacturersForAutoComplete",
fields: ["id", "name"],
},
queryOptions: {
enabled: false,
refetchOnMount: false,
refetchOnWindowFocus: false,
onSuccess: (data) => {
const mfrs = data.data.map((b) => renderItem(b));
if (mfrs.length > 0) {
setOptions([
{
label: "Manufacturers",
options: mfrs,
},
]);
}
},
},
});
const { refetch: refetchManufacturers } = useList<IManufacturer>({
resource: "manufacturer",
config: {
filters: [{ field: "name", operator: "contains", value: `${value}%` }],
},
metaData: {
name: "ListManufacturersForAutoComplete",
fields: ["id", "name"],
},
queryOptions: {
enabled: false,
refetchOnMount: false,
refetchOnWindowFocus: false,
onSuccess: (data) => {
const mfrs = data.data.map((b) => renderItem(b));
if (mfrs.length > 0) {
setOptions([
{
label: "Manufacturers",
options: mfrs,
},
]);
}
},
},
});
1 Reply
harsh-harlequin
harsh-harlequin2y ago
actually nevermind, I think this is because refetch is in a useEffect