Skip to content

Commit 29d7f6c

Browse files
fix: Fix logic of setting downloadInfo
1 parent ab3b66e commit 29d7f6c

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/app/_next/static/chunks/1317-e2086c9a8f888acd.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11486,28 +11486,31 @@
1148611486

1148711487
const unsubscribe =
1148811488
theState.state.queueState.currentEntity.onChange(() => {
11489-
const data =
11490-
theState?.state?.queueState?.currentEntity?.value?.entity
11491-
?.mediaSourceData?.data;
11489+
const data = theState?.state?.queueState?.currentEntity?.value?.entity?.mediaSourceData?.data;
1149211490

1149311491
const dataString = JSON.stringify(data);
1149411492
const downloadInfoString = JSON.stringify(downloadInfo);
1149511493

11496-
if (data !== undefined && dataString !== downloadInfoString) {
11497-
setDownloadInfo(data);
11494+
if (dataString !== downloadInfoString) {
11495+
if (data === undefined) {
11496+
let retries = 5;
11497+
intervalId = setInterval(() => {
11498+
const rerequestedData = theState?.state?.queueState?.currentEntity?.value?.entity?.mediaSourceData?.data;
11499+
if ((retries <= 0) || (rerequestedData !== undefined)) {
11500+
setDownloadInfo(rerequestedData);
11501+
clearInterval(intervalId);
11502+
}
11503+
}, 200)
11504+
} else {
11505+
setDownloadInfo(data);
11506+
}
11507+
1149811508
}
1149911509
});
1150011510

11501-
if (downloadInfo === undefined) {
11502-
intervalId = setInterval(() => {
11503-
const data =
11504-
theState?.state?.queueState?.currentEntity?.value?.entity
11505-
?.mediaSourceData?.data;
11506-
if (data !== undefined) {
11507-
setDownloadInfo(data);
11508-
if (intervalId) clearInterval(intervalId);
11509-
}
11510-
}, 1000);
11511+
const data = theState?.state?.queueState?.currentEntity?.value?.entity?.mediaSourceData?.data;
11512+
if (data) {
11513+
setDownloadInfo(data);
1151111514
}
1151211515

1151311516
return () => {

0 commit comments

Comments
 (0)