Skip to content

Commit e685deb

Browse files
committed
another
1 parent 1e0849c commit e685deb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/svelte/src/internal/client/dom/blocks/svelte-component.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { hydrate_block_anchor } from '../hydration.js';
22
import { pause_effect, render_effect } from '../../reactivity/effects.js';
33
import { remove } from '../reconciler.js';
44
import { create_block } from './utils.js';
5+
import { current_effect } from '../../runtime.js';
56

67
// TODO this is very similar to `key`, can we deduplicate?
78

@@ -47,12 +48,12 @@ export function component(anchor, get_component, render_fn) {
4748
() => {
4849
render_fn(component);
4950

50-
const dom = block.d;
51+
// `render_fn` doesn't return anything, and we can't reference `effect`
52+
// yet, so we reference it indirectly as `current_effect`
53+
const dom = /** @type {import('#client').Effect} */ (current_effect).dom;
5154

5255
return () => {
53-
if (dom !== null) {
54-
remove(dom);
55-
}
56+
if (dom !== null) remove(dom);
5657
};
5758
},
5859
block,

0 commit comments

Comments
 (0)