fix/listener-accumulation #69

Merged
longjacksonle merged 11 commits from fix/listener-accumulation into main 2026-05-11 17:08:45 +02:00
No description provided.
Without explicit removal, every WS reconnect soft-refresh would register additional `htmx:wsOpen`, `htmx:beforeSwap`, `htmx:afterSwap`, `htmx:oobBeforeSwap`, and `htmx:oobAfterSwap` listeners on `document.body`. After N reconnects the subscribe frame would fire N times and scroll logic would run N times per swap.

Named functions replace the anonymous callbacks so they can be passed to `removeEventListener`. A `htmx:beforeCleanupElement` listener (with `{ once: true }`) on the nearest cleanup root tears everything down when HTMX replaces the enclosing fragment.
Without teardown, every soft-refresh (reconnect) adds another htmx:wsOpen listener on document.body, causing the subscribe frame to fire N times per reconnect. Wraps the handler in an IIFE and removes it via htmx:beforeCleanupElement, matching the pattern used in the composer and notify fixes.
chore: allow echo exit-code command in settings and tidy test assertion
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 28s
ae5911be59
longjacksonle deleted branch fix/listener-accumulation 2026-05-11 17:08:45 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!69
No description provided.