Repository navigation
fix: clear previous_task reference after abort in Tween - #18541
Merged
dummdidumm merged 2 commits intoJul 14, 2026
Merged
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/svelte/c/f22eac4dba89cfe83c6e4a584ec054dfd3ddc292Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: f22eac4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
dummdidumm
approved these changes
Jul 14, 2026
Merged
dummdidumm
pushed a commit
that referenced
this pull request
Jul 14, 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.56.5 ### Patch Changes - chore: drop dead code that make TSGO fail ([#18496](#18496)) - fix: don't (re)connect deriveds when read inside branch/root effects ([#18527](#18527)) - fix: skip unnecessary derived effect in earlier batch ([#18525](#18525)) - fix: avoid declaration tag warning in event handlers ([#18500](#18500)) - fix: abort deriveds own AbortSignal when it disconnects ([#18400](#18400)) - fix: ensure `$state.eager()` is correctly transormed for SSR output ([#18530](#18530)) - fix: correctly transform declaration tags during SSR ([#18492](#18492)) - fix: transform computed keys in keyed `{#each}` destructuring patterns ([#18521](#18521)) - fix: chain preprocessor sourcemaps with an empty `sources[0]` instead of dropping them ([#18518](#18518)) - fix: clear previous_task reference after abort in Tween to prevent memory leak on interrupted tweens ([#18541](#18541)) - fix: don't treat declaration tags as parts inside each blocks ([#18507](#18507)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
renovate Bot
added a commit
to cigaleapp/cigale
that referenced
this pull request
Jul 27, 2026
##### [v5.56.6](https://github.com/sveltejs/svelte/releases/tag/svelte%405.56.6) ##### Patch Changes - perf: skip unnecessary blocker analysis when compiling components without top-level await ([#18548](sveltejs/svelte#18548)) - fix: rerun derived that had an abort controller on reconnection ([#18551](sveltejs/svelte#18551)) ##### [v5.56.5](https://github.com/sveltejs/svelte/blob/HEAD/packages/svelte/CHANGELOG.md#5565) ##### Patch Changes - chore: drop dead code that make TSGO fail ([#18496](sveltejs/svelte#18496)) - fix: don't (re)connect deriveds when read inside branch/root effects ([#18527](sveltejs/svelte#18527)) - fix: skip unnecessary derived effect in earlier batch ([#18525](sveltejs/svelte#18525)) - fix: avoid declaration tag warning in event handlers ([#18500](sveltejs/svelte#18500)) - fix: abort deriveds own AbortSignal when it disconnects ([#18400](sveltejs/svelte#18400)) - fix: ensure `$state.eager()` is correctly transormed for SSR output ([#18530](sveltejs/svelte#18530)) - fix: correctly transform declaration tags during SSR ([#18492](sveltejs/svelte#18492)) - fix: transform computed keys in keyed `{#each}` destructuring patterns ([#18521](sveltejs/svelte#18521)) - fix: chain preprocessor sourcemaps with an empty `sources[0]` instead of dropping them ([#18518](sveltejs/svelte#18518)) - fix: clear previous\_task reference after abort in Tween to prevent memory leak on interrupted tweens ([#18541](sveltejs/svelte#18541)) - fix: don't treat declaration tags as parts inside each blocks ([#18507](sveltejs/svelte#18507))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.packages/svelte/src, add a changeset (npx changeset).Tests and linting
pnpm testand lint the project withpnpm lintProblem
Tween.set()(inpackages/svelte/src/motion/tweened.js) aborts the previous task when interrupted by a newset()call, but never clears theprevious_taskclosure variable afterward. Each newset()call's rAF loop closure retains a reference to the previous (already-aborted) task — and transitively, the entire chain of prior tasks — so on any long-lived or frequently-interruptedTween, memory grows unbounded across interruptions and is never released.No linked issue — new issue creation is currently restricted on this repo for my account, so filing the details directly here instead.
Repro
Chrome DevTools heap snapshots taken across repeated intervals show a steadily growing retainer chain rooted at
{promise, abort}→previous_task, never released between GC passes.Fix
One-line fix: null the
previous_taskreference immediately after aborting it, inside the!startedbranch of the rAF loop:previous_task?.abort(); +previous_task = null;This mirrors the identical pattern already present in the deprecated
tweened()store further up in the same file:It appears this line was dropped when the newer
Tweenclass was written.previous_taskis not read anywhere else after this point in the closure, so this change has no effect on control flow — it only releases a reference that was never used again.Verification
previous_taskretainer chain is fully eliminated post-fix, with allocation/collection back in balance.abort()/resolve/reject semantics — the fix only clears a variable, it doesn't alter when or how tasks are aborted.pnpm test: 7558 passed, 154 skipped. One unrelated failure inruntime-browser/test.tsdue to a missing local Playwright browser binary (environment-only, not present in CI).pnpm lint: clean.Happy to add a regression test if maintainers can point me to the right pattern under
packages/svelte/tests/motion— didn't want to guess at the existing test conventions for this file.