Skip to content

fix: don't run teardown effects when deriveds are unfreezed#18227

Merged
dummdidumm merged 1 commit into
mainfrom
derived-unfreeze-fix
May 18, 2026
Merged

fix: don't run teardown effects when deriveds are unfreezed#18227
dummdidumm merged 1 commit into
mainfrom
derived-unfreeze-fix

Conversation

@dummdidumm

@dummdidumm dummdidumm commented May 15, 2026

Copy link
Copy Markdown
Member

The logic was flawed - a teardown effect only has a teardown function but not fn property, but unfreeze thought that everything with a teardown needs to be unfreezed

Helps with #18221 (though likely doesn't fix it completely, at least not the more general batch.#rootsproblems)

The logic was flawed - a teardown effect only has a teardown function but not `fn` property, but unfreeze thought that everything with a `teardown` needs to be unfreezed
@changeset-bot

changeset-bot Bot commented May 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7611b4b

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

@svelte-docs-bot

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@18227

@Rich-Harris

Rich-Harris commented May 18, 2026

Copy link
Copy Markdown
Member

I'm instinctively suspicious of this change. It seems wrong that there should be any observable difference between these:

teardown(() => {...});
render_effect(() => () => {...});

Would it be more correct to draw a distinction between user effects (including e.g. $effect.pre and attachments) and internal ones?

Edit: I understand now!

@dummdidumm dummdidumm merged commit dc1f037 into main May 18, 2026
21 checks passed
@dummdidumm dummdidumm deleted the derived-unfreeze-fix branch May 18, 2026 15:37
@github-actions github-actions Bot mentioned this pull request May 18, 2026
dummdidumm pushed a commit that referenced this pull request May 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.55.8

### Patch Changes

- fix(print): handle `svelte:body` and fix keyframe percentage
double-printing
([#18234](#18234))

- fix: execute uninitialized derived even if it's destroyed
([#18228](#18228))

- fix: use named symbols everywhere
([#18238](#18238))

- fix: don't run teardown effects when deriveds are unfreezed
([#18227](#18227))

- fix: unset context synchronously in `run`
([#18236](#18236))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants