Fix Download page not refetching on page change

This commit is contained in:
MerlinScheurer
2025-03-29 10:56:26 +01:00
parent 0d1bdb8904
commit 947ec803b3
2 changed files with 11 additions and 7 deletions

View File

@@ -80,7 +80,11 @@ const Base = () => {
useEffect(() => { useEffect(() => {
if (currentPageFromUrl !== currentPage) { if (currentPageFromUrl !== currentPage) {
setSearchParams(params => { setSearchParams(params => {
params.set('page', currentPage.toString()); if (currentPage == 0) {
params.delete('page');
} else {
params.set('page', currentPage.toString());
}
return params; return params;
}); });

View File

@@ -117,7 +117,11 @@ const Download = () => {
})(); })();
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [refresh, showIgnored, currentPage]); }, [refresh]);
useEffect(() => {
setRefresh(true);
}, [channelFilterFromUrl, currentPage, showIgnored]);
useEffect(() => { useEffect(() => {
(async () => { (async () => {
@@ -127,10 +131,6 @@ const Download = () => {
})(); })();
}, [lastVideoCount, showIgnored]); }, [lastVideoCount, showIgnored]);
useEffect(() => {
setRefresh(true);
}, [channelFilterFromUrl]);
return ( return (
<> <>
<title>TA | Downloads</title> <title>TA | Downloads</title>
@@ -262,7 +262,7 @@ const Download = () => {
const params = searchParams; const params = searchParams;
if (value !== 'all') { if (value !== 'all') {
params.append('channel', value); params.set('channel', value);
} else { } else {
params.delete('channel'); params.delete('channel');
} }