chore: move DOM-related effect properties to effect.nodes#17293
Merged
Rich-Harris merged 11 commits intomainfrom Dec 2, 2025
Merged
chore: move DOM-related effect properties to effect.nodes#17293Rich-Harris merged 11 commits intomainfrom
effect.nodes#17293Rich-Harris merged 11 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: bf195b5 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 |
Contributor
|
Member
Author
|
gonna go ahead and self-merge this to unblock further work, otherwise it will become very hairy to juggle everything |
|
I just wanted to up vote the rethinking of animations, and I do like the idea of lifting animations restriction to just each block. I think a lot of us in animations have been wanting it but not noisy about it 😅 |
sounds like a great idea |
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.
Currently, an
Effecthas three properties that default tonull—nodes_start,nodes_end, andtransitions— and which are only used if the effect is abrancheffect (orhtml/headeffect, but you get the idea).Since smaller objects are faster to work with and take up less memory, it's almost certainly preferable to reduce that to a single property,
nodes, which is populated if it's the sort of effect that contains DOM.My real motivation is this, though: I'm working through the edge cases in #17258 and it's hellishly complicated, made doubly so by the fact that every
eachblock has two linked lists that resemble each other but don't fully match — a list of 'items' and a list of their effects. We only really need the second of these. Getting rid of the items list will reduce memory usage, and reduce the amount of work that needs to happen during reconciliation. But to get there, we need to move theAnimationManagerfromEachItemand ontoEffect. If it became a direct property ofEffectthat would add unnecessary overhead (animations are exceedingly rare, relative to effects as a whole). But if it's part ofnodes, it's fine. Hence the larger change.(It's possible that by putting animations on effects, we could eventually relax the restriction that says the
animate:directive has to be a direct child of a keyedeachblock, though that's a separate conversation that will probably be overtaken by a broader rethink of how animations and transitions work.)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 lint