From 19a971cc1d0f2f69b882aee2ca3c882b74e22bb7 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Mon, 24 Aug 2026 15:40:01 +0200 Subject: [PATCH] fix: include `segments` in upstream changes to hrm and svelte head --- packages/svelte/src/internal/client/dev/hmr.js | 11 +++++++++-- .../src/internal/client/dom/blocks/svelte-head.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/svelte/src/internal/client/dev/hmr.js b/packages/svelte/src/internal/client/dev/hmr.js index 0e988fe66d..d1b107f539 100644 --- a/packages/svelte/src/internal/client/dev/hmr.js +++ b/packages/svelte/src/internal/client/dev/hmr.js @@ -60,7 +60,7 @@ export function hmr(fn) { // Forward the start/end DOM nodes from the inner effect to the outer active effect // which would get them if the HMR wrapper wasn't there. Do this inside the block not // outside so that HMR updates to the component will also update the nodes on the - // active effect. We copy only start/end, not the full nodes object, so that + // active effect. We copy only the removal ranges, not the full nodes object, so that // pause_children does not collect transitions from both effects and fire outroend twice. var inner_nodes = effect.nodes; if (inner_nodes) { @@ -68,8 +68,15 @@ export function hmr(fn) { if (ae.nodes) { ae.nodes.start = inner_nodes.start; ae.nodes.end = inner_nodes.end; + ae.nodes.segments = inner_nodes.segments; } else { - ae.nodes = { start: inner_nodes.start, end: inner_nodes.end, a: null, t: null }; + ae.nodes = { + start: inner_nodes.start, + end: inner_nodes.end, + segments: inner_nodes.segments, + a: null, + t: null + }; } } }, EFFECT_TRANSPARENT); diff --git a/packages/svelte/src/internal/client/dom/blocks/svelte-head.js b/packages/svelte/src/internal/client/dom/blocks/svelte-head.js index 9b3671d032..730f67b6d0 100644 --- a/packages/svelte/src/internal/client/dom/blocks/svelte-head.js +++ b/packages/svelte/src/internal/client/dom/blocks/svelte-head.js @@ -64,7 +64,7 @@ export function head(hash, render_fn) { if (!hydrating) { if (e.nodes === null) { - e.nodes = { start: anchor, end: anchor, a: null, t: null }; + e.nodes = { start: anchor, end: anchor, segments: null, a: null, t: null }; } else { e.nodes.end = anchor; }