Skip to content

fix: cancel deferred event listener attachment - #18749

Merged
dummdidumm merged 1 commit into
mainfrom
triage/svelte-18748-cancel-deferred-events
Aug 31, 2026
Merged

dummdidumm merged 1 commit into
mainfrom
triage/svelte-18748-cancel-deferred-events

Conversation

@svelte-triage-bot

Copy link
Copy Markdown
Contributor

What

  • Cancel deferred pointer, touch, and wheel listener attachment when cleanup runs first
  • Apply cancellation to both svelte/events subscriptions and template global-event teardown
  • Preserve synchronous removal for listeners whose deferred attachment already completed
  • Add runtime regressions covering both cleanup paths

Fixes #18748

Test plan

  • pnpm test runtime-runes -t event-cleanup-before-attachment
  • pnpm test runtime-runes
  • cd packages/svelte && pnpm check
  • cd packages/svelte && pnpm build
  • pnpm format
  • pnpm lint

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6290354

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of svelte from 6290354:

pnpm add https://pkg.svelte.dev/svelte/c/6290354cb06e809feba9151217c0667f3858122a

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/svelte/pr/18749

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@dummdidumm
dummdidumm marked this pull request as ready for review August 31, 2026 06:38
@dummdidumm
dummdidumm merged commit 214dd3d into sveltejs:main Aug 31, 2026
11 of 12 checks passed
@dummdidumm
dummdidumm deleted the triage/svelte-18748-cancel-deferred-events branch August 31, 2026 06:39
@github-actions github-actions Bot mentioned this pull request Aug 31, 2026
kkennethlau12393 pushed a commit to kkennethlau12393/sveltejs__svelte that referenced this pull request Sep 1, 2026
kkennethlau12393 pushed a commit to kkennethlau12393/sveltejs__svelte that referenced this pull request Sep 2, 2026
kkennethlau12393 pushed a commit to kkennethlau12393/sveltejs__svelte that referenced this pull request Sep 3, 2026
kkennethlau12393 pushed a commit to kkennethlau12393/sveltejs__svelte that referenced this pull request Sep 3, 2026
kkennethlau12393 pushed a commit to kkennethlau12393/sveltejs__svelte that referenced this pull request Sep 5, 2026
Rich-Harris pushed a commit that referenced this pull request Sep 18, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## svelte@5.57.1

### Patch Changes

- fix: cancel deferred event listeners during cleanup
([#18749](#18749))

- fix: preserve global CSS in components without scopable elements
([#18793](#18793))

- fix: reduce SSR render result garbage collection
([#18798](#18798))

- fix: resolve the fallback of an each block in the enclosing scope
([#18803](#18803))

- perf: speed up parser interactions with Acorn or avoid them where
possible ([#18740](#18740))

- fix: prevent effect tree of batches from interfering with each other
([#18508](#18508))

- fix: serialize input default values during server rendering
([#18733](#18733))

- fix: remove `WAS_MARKED` flag in favor of `Set`
([#18127](#18127))

- fix: throw `set_context_after_init` when `setContext` is called after
an `await` during SSR
([#18739](#18739))

- fix: make Object.hasOwn reactive for state proxy ownership changes
([#18838](#18838))

- fix: keep `$state.eager` when used as a variable initializer
([#18809](#18809))

- perf: avoid regex matching in parser where possible
([#18736](#18736))

- fix: in non-async mode, only push variable to current_sources when
active_reaction is updating
([#18550](#18550))

- fix: recognise `aria-braillelabel` and `aria-brailleroledescription`
as known ARIA attributes
([#18765](#18765))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
dadezzz pushed a commit to dadezzz/events-cash-register that referenced this pull request Sep 23, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [svelte](https://svelte.dev) ([source](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte)) | [`5.57.0` → `5.57.1`](https://renovatebot.com/diffs/npm/svelte/5.57.0/5.57.1) | ![age](https://developer.mend.io/api/mc/badges/age/npm/svelte/5.57.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/svelte/5.57.0/5.57.1?slim=true) |

---

### Release Notes

<details>
<summary>sveltejs/svelte (svelte)</summary>

### [`v5.57.1`](https://github.com/sveltejs/svelte/blob/HEAD/packages/svelte/CHANGELOG.md#5571)

[Compare Source](https://github.com/sveltejs/svelte/compare/svelte@5.57.0...svelte@5.57.1)

##### Patch Changes

- fix: cancel deferred event listeners during cleanup ([#&#8203;18749](sveltejs/svelte#18749))

- fix: preserve global CSS in components without scopable elements ([#&#8203;18793](sveltejs/svelte#18793))

- fix: reduce SSR render result garbage collection ([#&#8203;18798](sveltejs/svelte#18798))

- fix: resolve the fallback of an each block in the enclosing scope ([#&#8203;18803](sveltejs/svelte#18803))

- perf: speed up parser interactions with Acorn or avoid them where possible ([#&#8203;18740](sveltejs/svelte#18740))

- fix: prevent effect tree of batches from interfering with each other ([#&#8203;18508](sveltejs/svelte#18508))

- fix: serialize input default values during server rendering ([#&#8203;18733](sveltejs/svelte#18733))

- fix: remove `WAS_MARKED` flag in favor of `Set` ([#&#8203;18127](sveltejs/svelte#18127))

- fix: throw `set_context_after_init` when `setContext` is called after an `await` during SSR ([#&#8203;18739](sveltejs/svelte#18739))

- fix: make Object.hasOwn reactive for state proxy ownership changes ([#&#8203;18838](sveltejs/svelte#18838))

- fix: keep `$state.eager` when used as a variable initializer ([#&#8203;18809](sveltejs/svelte#18809))

- perf: avoid regex matching in parser where possible ([#&#8203;18736](sveltejs/svelte#18736))

- fix: in non-async mode, only push variable to current\_sources when active\_reaction is updating ([#&#8203;18550](sveltejs/svelte#18550))

- fix: recognise `aria-braillelabel` and `aria-brailleroledescription` as known ARIA attributes ([#&#8203;18765](sveltejs/svelte#18765))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMDQuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjEwOS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 5, 2026
##### [v5.57.1](https://github.com/sveltejs/svelte/blob/HEAD/packages/svelte/CHANGELOG.md#5571)

##### Patch Changes

- fix: cancel deferred event listeners during cleanup ([#18749](sveltejs/svelte#18749))

- fix: preserve global CSS in components without scopable elements ([#18793](sveltejs/svelte#18793))

- fix: reduce SSR render result garbage collection ([#18798](sveltejs/svelte#18798))

- fix: resolve the fallback of an each block in the enclosing scope ([#18803](sveltejs/svelte#18803))

- perf: speed up parser interactions with Acorn or avoid them where possible ([#18740](sveltejs/svelte#18740))

- fix: prevent effect tree of batches from interfering with each other ([#18508](sveltejs/svelte#18508))

- fix: serialize input default values during server rendering ([#18733](sveltejs/svelte#18733))

- fix: remove `WAS_MARKED` flag in favor of `Set` ([#18127](sveltejs/svelte#18127))

- fix: throw `set_context_after_init` when `setContext` is called after an `await` during SSR ([#18739](sveltejs/svelte#18739))

- fix: make Object.hasOwn reactive for state proxy ownership changes ([#18838](sveltejs/svelte#18838))

- fix: keep `$state.eager` when used as a variable initializer ([#18809](sveltejs/svelte#18809))

- perf: avoid regex matching in parser where possible ([#18736](sveltejs/svelte#18736))

- fix: in non-async mode, only push variable to current\_sources when active\_reaction is updating ([#18550](sveltejs/svelte#18550))

- fix: recognise `aria-braillelabel` and `aria-brailleroledescription` as known ARIA attributes ([#18765](sveltejs/svelte#18765))
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 5, 2026
##### [v5.57.1](https://github.com/sveltejs/svelte/blob/HEAD/packages/svelte/CHANGELOG.md#5571)

##### Patch Changes

- fix: cancel deferred event listeners during cleanup ([#18749](sveltejs/svelte#18749))

- fix: preserve global CSS in components without scopable elements ([#18793](sveltejs/svelte#18793))

- fix: reduce SSR render result garbage collection ([#18798](sveltejs/svelte#18798))

- fix: resolve the fallback of an each block in the enclosing scope ([#18803](sveltejs/svelte#18803))

- perf: speed up parser interactions with Acorn or avoid them where possible ([#18740](sveltejs/svelte#18740))

- fix: prevent effect tree of batches from interfering with each other ([#18508](sveltejs/svelte#18508))

- fix: serialize input default values during server rendering ([#18733](sveltejs/svelte#18733))

- fix: remove `WAS_MARKED` flag in favor of `Set` ([#18127](sveltejs/svelte#18127))

- fix: throw `set_context_after_init` when `setContext` is called after an `await` during SSR ([#18739](sveltejs/svelte#18739))

- fix: make Object.hasOwn reactive for state proxy ownership changes ([#18838](sveltejs/svelte#18838))

- fix: keep `$state.eager` when used as a variable initializer ([#18809](sveltejs/svelte#18809))

- perf: avoid regex matching in parser where possible ([#18736](sveltejs/svelte#18736))

- fix: in non-async mode, only push variable to current\_sources when active\_reaction is updating ([#18550](sveltejs/svelte#18550))

- fix: recognise `aria-braillelabel` and `aria-brailleroledescription` as known ARIA attributes ([#18765](sveltejs/svelte#18765))
renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Oct 5, 2026
##### [v5.57.1](https://github.com/sveltejs/svelte/blob/HEAD/packages/svelte/CHANGELOG.md#5571)

##### Patch Changes

- fix: cancel deferred event listeners during cleanup ([#18749](sveltejs/svelte#18749))

- fix: preserve global CSS in components without scopable elements ([#18793](sveltejs/svelte#18793))

- fix: reduce SSR render result garbage collection ([#18798](sveltejs/svelte#18798))

- fix: resolve the fallback of an each block in the enclosing scope ([#18803](sveltejs/svelte#18803))

- perf: speed up parser interactions with Acorn or avoid them where possible ([#18740](sveltejs/svelte#18740))

- fix: prevent effect tree of batches from interfering with each other ([#18508](sveltejs/svelte#18508))

- fix: serialize input default values during server rendering ([#18733](sveltejs/svelte#18733))

- fix: remove `WAS_MARKED` flag in favor of `Set` ([#18127](sveltejs/svelte#18127))

- fix: throw `set_context_after_init` when `setContext` is called after an `await` during SSR ([#18739](sveltejs/svelte#18739))

- fix: make Object.hasOwn reactive for state proxy ownership changes ([#18838](sveltejs/svelte#18838))

- fix: keep `$state.eager` when used as a variable initializer ([#18809](sveltejs/svelte#18809))

- perf: avoid regex matching in parser where possible ([#18736](sveltejs/svelte#18736))

- fix: in non-async mode, only push variable to current\_sources when active\_reaction is updating ([#18550](sveltejs/svelte#18550))

- fix: recognise `aria-braillelabel` and `aria-brailleroledescription` as known ARIA attributes ([#18765](sveltejs/svelte#18765))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

on() from svelte/events: unsubscribing before the deferred attach permanently leaks wheel/pointer/touch listeners

1 participant