Skip to content

Commit 85cf76e

Browse files
committed
feat(disconnect): improve deleting component
1 parent 7b4ff7e commit 85cf76e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function mount(
2626
): () => void {
2727
const shadowResult: ShadowCache = new ShadowCache(false);
2828

29-
return effect(() => {
29+
const disconnect = effect(() => {
3030
active.parentElement = parent;
3131

3232
reconcile({
@@ -37,6 +37,11 @@ export function mount(
3737
getParentOverwrite: null,
3838
});
3939
});
40+
41+
return () => {
42+
disconnect();
43+
shadowResult.remove();
44+
};
4045
}
4146

4247
export function createComponent<

0 commit comments

Comments
 (0)