@@ -56,16 +56,24 @@ export function hmr(hot_data, new_component) {
56
56
if ( hot_data . proxy ) {
57
57
set ( hot_data . component_signal , new_component ) ;
58
58
} else {
59
- const component_signal = source ( new_component ) ;
60
-
61
- hot_data . component_signal = component_signal ;
59
+ hot_data . component_signal = source ( new_component ) ;
62
60
63
61
// @ts -ignore
64
62
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
+
65
67
// During hydration the root component will receive a null $$anchor. The
66
68
// following is a hack to get our `key` a node to render to, all while
67
69
// avoiding it to "consume" the SSR marker.
70
+ //
68
71
// 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
+ //
69
77
if ( ! $$anchor && current_hydration_fragment ?. [ 0 ] ) {
70
78
const ssr0 = find_surrounding_ssr_commments ( ) ;
71
79
if ( ssr0 ) {
@@ -76,15 +84,11 @@ export function hmr(hot_data, new_component) {
76
84
}
77
85
}
78
86
79
- const accessors_proxy = proxy ( /** @type {import('./proxy/proxy.js').StateObject } */ ( { } ) ) ;
80
- /** @type {Set<string> } */
81
- const accessors_keys = new Set ( ) ;
82
-
83
87
key (
84
88
$$anchor ,
85
- ( ) => get ( component_signal ) ,
89
+ ( ) => get ( hot_data . component_signal ) ,
86
90
( $$anchor ) => {
87
- const component = get ( component_signal ) ;
91
+ const component = get ( hot_data . component_signal ) ;
88
92
// @ts -ignore
89
93
const new_accessors = component ( $$anchor , ...args ) ;
90
94
0 commit comments