Downloads: fix collapsed-batch overflow (#814) + Retry Failed result feedback (#815)

#814 — the collapsed Batches rail (44px) hid .adl-batch-active and
.adl-batch-history-section but NOT the JS-rendered .adl-batch-summary line
("N batches · M downloading · …"), so it overflowed as clipped text. Added it
to the collapsed hide rule.

#815 — "Retry Failed" only toasted "Retrying N…" at the start and a generic
"Discovery complete!" at the end, with no sense of how many of the retried
tracks actually progressed. retryFailedMirroredDiscovery now stamps a baseline
(matches-before + retry count) on the state, and a shared completion toast
reports "Retry complete: X of N newly found[, Y still not found]" instead of
the generic message. Normal (non-retry) discovery still shows "Discovery
complete!".

JS syntax clean, 70 script-split/style tests pass.
This commit is contained in:
BoulderBadgeDad 2026-06-07 23:53:18 -07:00
parent 40e3dac881
commit 902eb38fb8
3 changed files with 31 additions and 3 deletions

View file

@ -1678,6 +1678,12 @@ async function retryFailedMirroredDiscovery(urlHash) {
state.phase = 'discovering';
state.status = 'discovering';
state.discovery_progress = 0;
// #815: stamp a baseline so the completion toast can report how many
// of these retried tracks were newly found (not just overall matched).
state._retryDiscovery = {
matchesBefore: state.spotify_matches || 0,
retryCount: data.retry_count,
};
}
// Update modal buttons to show discovering state

View file

@ -59389,7 +59389,11 @@ body.reduce-effects #page-particles-canvas {
}
.adl-batch-panel.collapsed .adl-batch-active,
.adl-batch-panel.collapsed .adl-batch-history-section {
.adl-batch-panel.collapsed .adl-batch-history-section,
/* The active-batches summary line ("N batches · M downloading · …") is shown
via JS and was NOT hidden on collapse, so it overflowed the 44px rail as
clipped text (#814). Hide it with the rest of the panel body. */
.adl-batch-panel.collapsed .adl-batch-summary {
display: none;
}

View file

@ -9248,6 +9248,24 @@ async function startYouTubeDiscovery(urlHash) {
}
}
// Discovery-complete toast. For a "Retry Failed" run (#815) it reports how many
// of the retried tracks were newly found this attempt, instead of the generic
// message — the baseline is stamped on the state by retryFailedMirroredDiscovery.
function _discoveryCompleteToast(urlHash) {
const st = youtubePlaylistStates[urlHash];
const retry = st && st._retryDiscovery;
if (retry) {
const found = Math.max(0, (st.spotify_matches || 0) - (retry.matchesBefore || 0));
const stillFailed = Math.max(0, (retry.retryCount || 0) - found);
delete st._retryDiscovery;
let msg = `Retry complete: ${found} of ${retry.retryCount} newly found`;
if (stillFailed > 0) msg += `, ${stillFailed} still not found`;
showToast(msg, found > 0 ? 'success' : 'info');
return;
}
showToast('Discovery complete!', 'success');
}
function startYouTubeDiscoveryPolling(urlHash) {
// Stop any existing polling
if (activeYouTubePollers[urlHash]) {
@ -9274,7 +9292,7 @@ function startYouTubeDiscoveryPolling(urlHash) {
if (st) st.phase = 'discovered';
updateYouTubeCardPhase(urlHash, 'discovered');
updateYouTubeModalButtons(urlHash, 'discovered');
showToast('Discovery complete!', 'success');
_discoveryCompleteToast(urlHash);
}
};
}
@ -9322,7 +9340,7 @@ function startYouTubeDiscoveryPolling(urlHash) {
updateYouTubeModalButtons(urlHash, 'discovered');
console.log('✅ Discovery complete:', urlHash);
showToast('Discovery complete!', 'success');
_discoveryCompleteToast(urlHash);
}
} catch (error) {