Skip to content
weftGitHub

Diagnostics

W050

Raw addEventListener, setInterval, new WebSocket or new EventSource in a component with no cleanup (it outlives the component).

Fix: on(target, type, fn) / interval(ms, fn) from @weft-js/core/browser, or clean it up in onCleanup.

Status in weft@0.1.0: reported, suggested edit.

Triggers it:

tsx
export function A() { window.addEventListener('keydown', () => {}); return <p /> }

More: weft docs browser.