From 9d8fda6d467b960e942862730f7f99f12de842f3 Mon Sep 17 00:00:00 2001 From: byrongamatos Date: Sun, 12 Jul 2026 21:09:00 +0200 Subject: [PATCH] fix(venue-crowd): always detach load listeners, gate only the callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex preflight: superseded loads left canplaythrough/error listeners attached to the persistent video elements — unbounded growth over a session. Co-Authored-By: Claude Fable 5 --- static/v3/venue-crowd.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/v3/venue-crowd.js b/static/v3/venue-crowd.js index adbbb53..0a64e3c 100644 --- a/static/v3/venue-crowd.js +++ b/static/v3/venue-crowd.js @@ -216,10 +216,14 @@ const gen = _stopGen; let settled = false; const settle = (ok) => { - if (settled || token !== video._fbCrowdToken || gen !== _stopGen) return; + if (settled) return; settled = true; + // Cleanup must run even for superseded loads or stale listeners + // accumulate on the two persistent elements; only the callback + // is gated on still being the current load. video.removeEventListener('canplaythrough', onReady); video.removeEventListener('error', onError); + if (token !== video._fbCrowdToken || gen !== _stopGen) return; cb(ok); }; const onReady = () => settle(true);