fix: correctly set anchor inside HMR block (#12575)

pull/12576/head
Rich Harris 5 months ago committed by GitHub
parent 642f5f4df8
commit 9f3ed8968f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: correctly set anchor inside HMR block

@ -1,6 +1,7 @@
/** @import { Source, Effect } from '#client' */
/** @import { Source, Effect, TemplateNode } from '#client' */
import { FILENAME, HMR } from '../../../constants.js';
import { EFFECT_TRANSPARENT } from '../constants.js';
import { hydrate_node, hydrating } from '../dom/hydration.js';
import { block, branch, destroy_effect } from '../reactivity/effects.js';
import { source } from '../reactivity/sources.js';
import { set_should_intro } from '../render.js';
@ -13,7 +14,7 @@ import { get } from '../runtime.js';
*/
export function hmr(original, get_source) {
/**
* @param {Comment} anchor
* @param {TemplateNode} anchor
* @param {any} props
*/
function wrapper(anchor, props) {
@ -53,6 +54,10 @@ export function hmr(original, get_source) {
ran = true;
if (hydrating) {
anchor = hydrate_node;
}
return instance;
}

Loading…
Cancel
Save