mirror of https://github.com/sveltejs/svelte
The strong reference exists to stop Firefox (<= 141) from garbage collecting the event wrapper mid-propagation, which loses the __root expando and causes delegated handlers to run twice (#16522). But the reference was never released, so between user interactions the module retains the last delegated event - and through event.target the entire detached subtree of whatever component the user last clicked in, until the next delegated event happens to arrive. Dispatch is synchronous within a task, so a task scheduled during propagation runs strictly after the event has finished reaching every delegated root (including all microtask checkpoints between listeners). Clearing the reference there preserves the Firefox workaround exactly while bounding the retention to milliseconds. Verified against the #16522 reproduction on Firefox 141 (where the wrapper GC bug reproduces reliably): pin-with-deferred-clear loses zero events across 200 clicks under GC pressure, identical to the permanent pin, while clearing in a microtask instead reintroduces the double processing at the same rate as having no pin at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>pull/18569/head
parent
b29d7002ec
commit
4a0d1c7561
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: release `last_propagated_event` after event propagation settles so it no longer retains the last event's target subtree
|
||||
Loading…
Reference in new issue