also remove video from the dom

This commit is contained in:
Simon
2026-06-24 20:42:37 +00:00
parent e3eeaacc53
commit b931765c06
2 changed files with 19 additions and 5 deletions

View File

@@ -814,7 +814,19 @@ App.videos = App.videos || {};
if (el) { el.innerHTML = ''; el.style.height = '0px'; }
};
return { ensureInit, packFrom, update: scheduleUpdate, relayout, reset };
// Removes a single video's card from the grid: its DOM element is
// unmounted directly (so it's gone even if the re-pack below can't run),
// then the remaining cards are re-packed against the now-shorter queue.
// The caller must have already removed the video from state.loadedVideos.
const removeVideo = function(videoId) {
const id = String(videoId);
mounted.forEach((card, i) => {
if (card.dataset.videoId === id) unmount(i);
});
relayout();
};
return { ensureInit, packFrom, update: scheduleUpdate, relayout, removeVideo, reset };
})();
App.videos.updateLoadMoreState = function() {