fix: remove anchor from target on `unmount`

pull/18058/head
paoloricciuti 5 months ago
parent 62d1ce7822
commit 8a8b779586

@ -4,6 +4,7 @@ import { boundary } from '../dom/blocks/boundary.js';
import { branch, effect_root } from '../reactivity/effects.js'; import { branch, effect_root } from '../reactivity/effects.js';
import { push, pop, component_context } from '../context.js'; import { push, pop, component_context } from '../context.js';
import { push_renderer } from './state.js'; import { push_renderer } from './state.js';
import { get_parent_node, remove_child } from '../dom/operations.js';
/** /**
* @template {object} [TFragment=object] * @template {object} [TFragment=object]
@ -64,6 +65,11 @@ export function createRenderer(renderer) {
}); });
pop(); pop();
}); });
return () => {
var parent = get_parent_node(/** @type {*} */ (anchor));
if (parent) remove_child(parent, /** @type {*} */ (anchor));
};
}); });
return unmount; return unmount;
} finally { } finally {

Loading…
Cancel
Save