Skip to content

Commit 0d7ba6a

Browse files
committed
chore: remove redundant hydration code
chore: remove redundant hydration code
1 parent 3e3ae92 commit 0d7ba6a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.changeset/sour-forks-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
chore: remove redundant hydration code

packages/svelte/src/internal/client/hydration.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,11 @@ export function hydrate_block_anchor(anchor_node, is_controlled) {
6868
let fragment = target_node.$$fragment;
6969
if (fragment === undefined) {
7070
fragment = get_hydration_fragment(target_node);
71-
// @ts-ignore remove to prevent memory leaks
72-
target_node.$$fragment = undefined;
7371
}
7472
set_current_hydration_fragment(fragment);
7573
} else {
76-
set_current_hydration_fragment([/** @type {Element} */ (target_node.firstChild)]);
74+
const firstChild = /** @type {Element | null} */ (target_node.firstChild);
75+
set_current_hydration_fragment(firstChild === null ? [] : [firstChild]);
7776
}
7877
}
7978
}

0 commit comments

Comments
 (0)