@@ -63,8 +63,8 @@ export class Boundary {
63
63
/** @type {TemplateNode } */
64
64
#anchor;
65
65
66
- /** @type {TemplateNode } */
67
- #hydrate_open;
66
+ /** @type {TemplateNode | null } */
67
+ #hydrate_open = hydrating ? hydrate_node : null ;
68
68
69
69
/** @type {BoundaryProps } */
70
70
#props;
@@ -92,8 +92,6 @@ export class Boundary {
92
92
93
93
#is_creating_fallback = false ;
94
94
95
- #server_rendered_pending = false ;
96
-
97
95
/**
98
96
* A source containing the number of pending async deriveds/expressions.
99
97
* Only created if `$effect.pending()` is used inside the boundary,
@@ -131,10 +129,6 @@ export class Boundary {
131
129
this . #props = props ;
132
130
this . #children = children ;
133
131
134
- this . #hydrate_open = hydrate_node ;
135
-
136
- this . #server_rendered_pending = this . #detect_server_state( ) ;
137
-
138
132
this . parent = /** @type {Effect } */ ( active_effect ) . b ;
139
133
140
134
this . #pending = ! ! this . #props. pending ;
@@ -143,8 +137,14 @@ export class Boundary {
143
137
/** @type {Effect } */ ( active_effect ) . b = this ;
144
138
145
139
if ( hydrating ) {
140
+ const comment = this . #hydrate_open;
146
141
hydrate_next ( ) ;
147
- if ( this . #server_rendered_pending) {
142
+
143
+ const server_rendered_pending =
144
+ /** @type {Comment } */ ( comment ) . nodeType === COMMENT_NODE &&
145
+ /** @type {Comment } */ ( comment ) . data === HYDRATION_START_ELSE ;
146
+
147
+ if ( server_rendered_pending ) {
148
148
this . #hydrate_pending_content( ) ;
149
149
} else {
150
150
this . #hydrate_resolved_content( ) ;
@@ -169,17 +169,6 @@ export class Boundary {
169
169
}
170
170
}
171
171
172
- #detect_server_state( ) {
173
- if ( ! hydrating || ! this . #hydrate_open) return false ;
174
-
175
- const comment = this . #hydrate_open;
176
- if ( comment . nodeType === COMMENT_NODE ) {
177
- return /** @type {Comment } */ ( comment ) . data === HYDRATION_START_ELSE ;
178
- }
179
-
180
- return false ;
181
- }
182
-
183
172
#hydrate_resolved_content( ) {
184
173
try {
185
174
this . #main_effect = branch ( ( ) => this . #children( this . #anchor) ) ;
@@ -344,7 +333,7 @@ export class Boundary {
344
333
}
345
334
346
335
if ( hydrating ) {
347
- set_hydrate_node ( this . #hydrate_open) ;
336
+ set_hydrate_node ( /** @type { TemplateNode } */ ( this . #hydrate_open) ) ;
348
337
next ( ) ;
349
338
set_hydrate_node ( remove_nodes ( ) ) ;
350
339
}
0 commit comments