fix(popularity): correct lazy-import path + forward video; single-instance modal

Two bugs in the #26 wiring surfaced live:
- The ⋯ menu lazy-import used "../../viewCountChart.js" which resolves one level
  too high (dist/viewCountChart.js → 404 "Failed to fetch dynamically imported
  module"). Corrected to "../viewCountChart.js" (js/ui → js/viewCountChart.js).
- The video-list context path called handleMoreMenuAction without the video, so
  view-stats hit "No video selected". Forward detail.video.

Also make the popularity modal single-instance: close any open one (proper
subscription/listener cleanup) before opening a new one, so the two menu paths
firing for one click can't stack duplicates or leak a live subscription.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-06-24 13:59:09 -04:00
1 parent 575befb83c
commit 6911df075a
2 files changed
+23 -3

No files matched your search

+2 -2
View File
@@ -157,7 +157,7 @@ export default class MoreMenuController {
...(detail.dataset || {}),
eventId: detail.dataset?.eventId || detail.video?.id || "",
};
this.handleMoreMenuAction(detail.action, dataset);
this.handleMoreMenuAction(detail.action, dataset, detail.video || null);
};
if (typeof view.addEventListener === "function") {
@@ -1176,7 +1176,7 @@ export default class MoreMenuController {
// ignore
}
try {
const { openPopularityModal } = await import("../../viewCountChart.js");
const { openPopularityModal } = await import("../viewCountChart.js");
openPopularityModal({ video: targetVideo });
} catch (error) {
userLogger.warn("[MoreMenu] Failed to open popularity modal:", error);