From eaae8066dacf73f9b8d62b5b30435249b2be7ddf Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 8 Oct 2025 12:39:51 -0400 Subject: [PATCH] Improve channel view loading and fix card menu --- js/channelProfile.js | 26 ++++++++++++++++++++++---- js/ui/components/VideoCard.js | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/js/channelProfile.js b/js/channelProfile.js index deff1985..39790921 100644 --- a/js/channelProfile.js +++ b/js/channelProfile.js @@ -1360,12 +1360,22 @@ export async function initChannelProfileView() { setupChannelShareButton(); setupChannelMoreMenu(); - await updateChannelMenuState(); + const initialMenuRefresh = updateChannelMenuState().catch((error) => { + console.error("Failed to prepare channel menu state:", error); + }); + + let subscriptionsTask = null; // 3) If user is logged in, load subscriptions and show sub/unsub button if (app?.pubkey) { - await subscriptions.loadSubscriptions(app.pubkey); - renderSubscribeButton(hexPub); + subscriptionsTask = subscriptions + .loadSubscriptions(app.pubkey) + .catch((error) => { + console.error("Failed to load subscriptions for channel view:", error); + }) + .finally(() => { + renderSubscribeButton(hexPub); + }); } else { const btn = document.getElementById("subscribeBtnArea"); if (btn) btn.classList.add("hidden"); @@ -1388,7 +1398,15 @@ export async function initChannelProfileView() { console.error("Failed to load channel videos:", error); }); - await Promise.allSettled([profilePromise, videosPromise]); + const pendingTasks = [profilePromise, videosPromise]; + if (initialMenuRefresh) { + pendingTasks.push(initialMenuRefresh); + } + if (subscriptionsTask) { + pendingTasks.push(subscriptionsTask); + } + + await Promise.allSettled(pendingTasks); } function setupZapButton() { diff --git a/js/ui/components/VideoCard.js b/js/ui/components/VideoCard.js index bbdb561f..735ba7e2 100644 --- a/js/ui/components/VideoCard.js +++ b/js/ui/components/VideoCard.js @@ -639,6 +639,7 @@ export class VideoCard { }, }); button.dataset.moreDropdown = String(this.index); + button.dataset.moreMenuToggleBound = "true"; const icon = this.document.createElement("img"); icon.src = "assets/svg/ellipsis.svg";