From 7db70330dc40d7a17b82759273d4563fd078ceac Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Mon, 6 Jul 2026 21:44:54 -0400 Subject: [PATCH] playlists(#37): fix playlist grid clobbered by the disclaimer-dismissed feed reload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a direct #view=playlist load, dismissing the first-visit disclaimer fired `application.loadVideos(true)` — a forced RECENT-feed load into the shared #videoList — which raced the playlist view's own fetch and replaced the playlist with recent videos. It only reproduced when the disclaimer showed, which is why it was intermittent ("sometimes"), and always after the playlist had already rendered ("loads then gets dropped"). The disclaimer-dismissed reload is now view-aware: for a playlist view it re-runs the playlist view's init (viewInitRegistry.playlist) so its grid re-renders, instead of force-loading the recent feed. Feed views keep the loadVideos reload. (A fuller fix would give the playlist view its own grid, decoupled from the feed system's #videoList — noted as a follow-up.) Lint + build clean. Co-Authored-By: Claude Opus 4.8 --- js/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/js/index.js b/js/index.js index a7caf6ae..945636dd 100644 --- a/js/index.js +++ b/js/index.js @@ -1283,6 +1283,25 @@ async function bootstrapInterface() { document.addEventListener( "bitvid:disclaimer-dismissed", () => { + // The playlist view (#37) reuses the shared #videoList but is NOT the + // recent feed — force-loading loadVideos() here would race the playlist's + // own fetch and replace it with recent videos. Re-run the current view's + // init for a playlist so its grid re-renders; only the feed grids want the + // recent reload. + const viewName = + ((window.location?.hash || "").match(/^#view=([^&]+)/) || [])[1] || ""; + if (viewName === "playlist") { + const initPlaylist = viewInitRegistry?.playlist; + if (typeof initPlaylist === "function") { + Promise.resolve(initPlaylist()).catch((error) => { + devLogger.warn( + "[Interface] Failed to re-render playlist after disclaimer dismissed:", + error, + ); + }); + } + return; + } if (application && typeof application.loadVideos === "function") { Promise.resolve(application.loadVideos(true)).catch((error) => { devLogger.warn(