Severity: P2 · Batch: B12 (with() chain cleanups — depends on B3's cleanup mechanism)
Location
src/core/with.js:40-83
Root cause
Every chain method calls the hook and drops its returned cleanup → with(el).useEvents({...}) inside a component leaks listeners on teardown unless the author separately plumbs cleanups (the chainable API gives them no handle to do so).
Proposed fix
Collect cleanups into the active hook context (the BUG-19 mechanism) or return them from the chain.
Verification recipe
Spec: inside a component, with(el).useEvents({ click: spy }); tear the component down; dispatch click; assert spy not called. Expected on unmodified code: spy fires (listener leaked) → confirmed.
Severity: P2 · Batch: B12 (with() chain cleanups — depends on B3's cleanup mechanism)
Location
src/core/with.js:40-83Root cause
Every chain method calls the hook and drops its returned cleanup →
with(el).useEvents({...})inside a component leaks listeners on teardown unless the author separately plumbs cleanups (the chainable API gives them no handle to do so).Proposed fix
Collect cleanups into the active hook context (the BUG-19 mechanism) or return them from the chain.
Verification recipe
Spec: inside a component,
with(el).useEvents({ click: spy }); tear the component down; dispatch click; assert spy not called. Expected on unmodified code: spy fires (listener leaked) → confirmed.