in main page (app.tsx) try to switch component WithAbort
and WithOutAbort
Test
component is not handle canceling request might be a error when component unmountedFix
component is handle canceling request by usingAbortController
see below
use AbortController(browser support) for cannel request
fetch
adding signal
opts in fetch
const rawData = await fetch("https://jsonplaceholder.typicode.com/todos/", {
signal: controller.signal,
});
const data = await rawData.json();
axios
adding signal
opts in axios
const data = await axios.get("https://jsonplaceholder.typicode.com/todos", {
signal: controller.signal,
});
ky might be a bug ??
refs
const data = await ky
.get("https://jsonplaceholder.typicode.com/todos", {
signal: controller.signal,
})
.json(); // not working as expected
see example in react useEffect here