BetterTyped / hyper-fetch

⚡ Fetching and realtime data exchange framework.
https://hyperfetch.bettertyped.com/
Apache License 2.0
1.02k stars 27 forks source link

The `disabled` option for `useFetch` ignored #69

Closed lmartins closed 1 year ago

lmartins commented 1 year ago

Describe the bug I was expecting to halt the query until the expression would evaluate true. Instead the fetch appears to always run, no matter what I pass to this param.

To Reproduce

const { data, error, loading } = useFetch(getSpeaker.setParams({ speaker: el.dataset.speaker }), {
    disabled: !showDrawer,
    refetchOnFocus: false,
});

Expected behavior I was expecting this to behave similarly to react-query, where the fetch will only happen once disabled evaluates to true. Is that a fair assumption?

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

lmartins commented 1 year ago

Apologies, I mixed up something on my codebase and this is indeed working as assumed. I was just looking at the wrong place.