mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-03 11:22:25 +00:00
playlists(#37): fix playlist grid clobbered by the disclaimer-dismissed feed reload
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 <[email protected]>
This commit is contained in:
1 parent
7cbd77110d
commit
7db70330dc
1 file changed
+19
+19
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user