Skip to content

fix: avoid forward the transition property inside EffectNodes in HMR#18498

Open
JaiWey wants to merge 2 commits into
sveltejs:mainfrom
JaiWey:onoutroend-twice
Open

fix: avoid forward the transition property inside EffectNodes in HMR#18498
JaiWey wants to merge 2 commits into
sveltejs:mainfrom
JaiWey:onoutroend-twice

Conversation

@JaiWey

@JaiWey JaiWey commented Jul 2, 2026

Copy link
Copy Markdown

Fixes #18440

Forward the the whole effect.nodes in HMR makes the onoutroend transition events fired twice.

I think only the start and end nodes matter here for the boundary tracking, so instead of forward the whole EffectNode, use the assign_nodes method.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 2, 2026

Copy link
Copy Markdown

Install the latest version of svelte from 3894cba:

pnpm add https://pkg.svelte.dev/svelte/c/3894cba2cbc339c935a0a16942ea509d16a66ddd

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

Note

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

@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3894cba

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

/** @type {Effect} */ (active_effect).nodes = effect.nodes;
if (effect.nodes) {
// only forward the start and end node
assign_nodes(effect.nodes.start, effect.nodes.end);

@vercel vercel Bot Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HMR node forwarding via assign_nodes only runs on first render, leaving the persistent block effect's start/end pointing at destroyed DOM after a component hot-update.

Fix on Vercel

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.

onoutroend fires twice when compiled with hmr:true, but only once without it

1 participant