in my current project the user clicks on a button, which starts some long running backend process via an API call.
Now I wanted to make use of the refreshing feature mentioned here, to get some status update from the API:
Once the backend task finishes, the API will respond with some special data, which I wanted to use to stop polling.
But I am unable to stop refreshing once it has been started. I tried setting refresh to false, and also tried setting disabled to true.
Hello again,
in my current project the user clicks on a button, which starts some long running backend process via an API call. Now I wanted to make use of the refreshing feature mentioned here, to get some status update from the API:
Once the backend task finishes, the API will respond with some special data, which I wanted to use to stop polling. But I am unable to stop refreshing once it has been started. I tried setting
refresh
to false, and also tried settingdisabled
to true.I think
refresh
here (https://github.com/BetterTyped/hyper-fetch/blob/ec9542266ad900560404464ee8443cea7ac1ffee/packages/react/src/hooks/use-fetch/use-fetch.hooks.ts#L102C10-L102C17) has not access to latest value.Is this a bug? Or am I doing something wrong?
I have created an example here: https://codesandbox.io/s/hyper-fetch-stop-refresh-fzgglc?file=/src/App.tsx Click the button to start polling for updates. After 5 seconds, polling should stop, but it does not. You can see that in the network tab of the dev tools.
Best Stefan