From 1e77d617ecf37eacc1a17fbe37370569ed77e85b Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:19:49 -0400 Subject: [PATCH] Refine channel profile video click handling --- js/channelProfile.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/js/channelProfile.js b/js/channelProfile.js index c4f0195d..2093fdc4 100644 --- a/js/channelProfile.js +++ b/js/channelProfile.js @@ -256,6 +256,10 @@ async function loadUserVideos(pubkey) { video.alreadyDecrypted = true; } + // Ensure the global videos map is kept up to date so delegated handlers + // have the freshest metadata for this event. + window.app?.videosMap?.set(video.id, video); + // Check if user can edit const canEdit = video.pubkey === app.pubkey; let hasOlder = false; @@ -338,8 +342,6 @@ async function loadUserVideos(pubkey) { const encodedUrl = encodeDataValue(video.url); const encodedMagnet = encodeDataValue(video.magnet); - const rawUrl = typeof video.url === "string" ? video.url : ""; - const rawMagnet = typeof video.magnet === "string" ? video.magnet : ""; cardEl.innerHTML = `
`; - // Clicking the card => open the video modal - cardEl.addEventListener("click", () => { - app.playVideoWithFallback({ - eventId: video.id, - url: rawUrl, - magnet: rawMagnet, - }); - }); - fragment.appendChild(cardEl); }); container.appendChild(fragment); + window.app.videoList = container; + window.app.attachVideoListHandler(); + // Lazy-load images const lazyEls = container.querySelectorAll("[data-lazy]"); lazyEls.forEach((el) => app.mediaLoader.observe(el));