fix: added a refresh interval if download status is in progress (#3275)

* fix: added a refresh interval if download status is in progress

* refactor: switched to a function instead of useEffect

* feat: added editable download sync schedule
This commit is contained in:
Brandon Cohen
2023-02-15 10:16:13 -05:00
committed by GitHub
parent dd1378cef5
commit 1e2c6f46ab
9 changed files with 125 additions and 30 deletions

View File

@@ -0,0 +1,18 @@
import type { DownloadingItem } from '@server/lib/downloadtracker';
export const refreshIntervalHelper = (
downloadItem: {
downloadStatus: DownloadingItem[] | undefined;
downloadStatus4k: DownloadingItem[] | undefined;
},
timer: number
) => {
if (
(downloadItem.downloadStatus ?? []).length > 0 ||
(downloadItem.downloadStatus4k ?? []).length > 0
) {
return timer;
} else {
return 0;
}
};