Skip to content

Commit 1c38090

Browse files
committed
bit of cleanup
1 parent 1aa61c1 commit 1c38090

File tree

1 file changed

+13
-9
lines changed
  • packages/svelte/src/internal/client

1 file changed

+13
-9
lines changed

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,24 @@ export function hmr(hot_data, new_component) {
5656
if (hot_data.proxy) {
5757
set(hot_data.component_signal, new_component);
5858
} else {
59-
const component_signal = source(new_component);
60-
61-
hot_data.component_signal = component_signal;
59+
hot_data.component_signal = source(new_component);
6260

6361
// @ts-ignore
6462
hot_data.proxy = function ($$anchor, ...args) {
63+
const accessors_proxy = proxy(/** @type {import('./proxy/proxy.js').StateObject} */ ({}));
64+
/** @type {Set<string>} */
65+
const accessors_keys = new Set();
66+
6567
// During hydration the root component will receive a null $$anchor. The
6668
// following is a hack to get our `key` a node to render to, all while
6769
// avoiding it to "consume" the SSR marker.
70+
//
6871
// TODO better get the eyes of someone with understanding of hydration on this
72+
//
73+
// If this failes, we get an ugly hydration failure message, but HMR should
74+
// still work after that... Maybe we can show a more specific error message than
75+
// the generic hydration failure one (that could be misleading in this case).
76+
//
6977
if (!$$anchor && current_hydration_fragment?.[0]) {
7078
const ssr0 = find_surrounding_ssr_commments();
7179
if (ssr0) {
@@ -76,15 +84,11 @@ export function hmr(hot_data, new_component) {
7684
}
7785
}
7886

79-
const accessors_proxy = proxy(/** @type {import('./proxy/proxy.js').StateObject} */ ({}));
80-
/** @type {Set<string>} */
81-
const accessors_keys = new Set();
82-
8387
key(
8488
$$anchor,
85-
() => get(component_signal),
89+
() => get(hot_data.component_signal),
8690
($$anchor) => {
87-
const component = get(component_signal);
91+
const component = get(hot_data.component_signal);
8892
// @ts-ignore
8993
const new_accessors = component($$anchor, ...args);
9094

0 commit comments

Comments
 (0)