I have a problem when I close a tab and then I undo that action. It basically executes all the cleanup functions in the component, aborting the new fetches that are needed to load the component (old cleanup functions are aborting new fetches). For Chrome and Firefox, it works fine. For what I have tested, it happens only on Safari.
React.useEffect(() => {
const abortController = new AbortController();
fetch(`${URL}${API.mediaDetails}`
+ `?id=${encodeURIComponent(props.match.params.id)}`
+ `&type=${encodeURIComponent(props.match.params.type)}`
+ `&lang=${encodeURIComponent(props.match.params.locale?.slice(0, 2))}`, {
signal: abortController.signal,
timeout: DOWNLOAD_HUB_REQ_TIMEOUT
}).then((res) => res.json()).then((res) => {
res.type = props.match.params.type;
return setDetails(res);
}).catch((err) => {
setDetails(null);
setError(err);
});
return () => abortController.abort();
}, [props.match.params]);