|
|
@ -63,8 +63,8 @@ export class Boundary {
|
|
|
|
/** @type {TemplateNode} */
|
|
|
|
/** @type {TemplateNode} */
|
|
|
|
#anchor;
|
|
|
|
#anchor;
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {TemplateNode} */
|
|
|
|
/** @type {TemplateNode | null} */
|
|
|
|
#hydrate_open;
|
|
|
|
#hydrate_open = hydrating ? hydrate_node : null;
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {BoundaryProps} */
|
|
|
|
/** @type {BoundaryProps} */
|
|
|
|
#props;
|
|
|
|
#props;
|
|
|
@ -92,8 +92,6 @@ export class Boundary {
|
|
|
|
|
|
|
|
|
|
|
|
#is_creating_fallback = false;
|
|
|
|
#is_creating_fallback = false;
|
|
|
|
|
|
|
|
|
|
|
|
#server_rendered_pending = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* A source containing the number of pending async deriveds/expressions.
|
|
|
|
* A source containing the number of pending async deriveds/expressions.
|
|
|
|
* Only created if `$effect.pending()` is used inside the boundary,
|
|
|
|
* Only created if `$effect.pending()` is used inside the boundary,
|
|
|
@ -131,10 +129,6 @@ export class Boundary {
|
|
|
|
this.#props = props;
|
|
|
|
this.#props = props;
|
|
|
|
this.#children = children;
|
|
|
|
this.#children = children;
|
|
|
|
|
|
|
|
|
|
|
|
this.#hydrate_open = hydrate_node;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.#server_rendered_pending = this.#detect_server_state();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.parent = /** @type {Effect} */ (active_effect).b;
|
|
|
|
this.parent = /** @type {Effect} */ (active_effect).b;
|
|
|
|
|
|
|
|
|
|
|
|
this.#pending = !!this.#props.pending;
|
|
|
|
this.#pending = !!this.#props.pending;
|
|
|
@ -143,8 +137,14 @@ export class Boundary {
|
|
|
|
/** @type {Effect} */ (active_effect).b = this;
|
|
|
|
/** @type {Effect} */ (active_effect).b = this;
|
|
|
|
|
|
|
|
|
|
|
|
if (hydrating) {
|
|
|
|
if (hydrating) {
|
|
|
|
|
|
|
|
const comment = this.#hydrate_open;
|
|
|
|
hydrate_next();
|
|
|
|
hydrate_next();
|
|
|
|
if (this.#server_rendered_pending) {
|
|
|
|
|
|
|
|
|
|
|
|
const server_rendered_pending =
|
|
|
|
|
|
|
|
/** @type {Comment} */ (comment).nodeType === COMMENT_NODE &&
|
|
|
|
|
|
|
|
/** @type {Comment} */ (comment).data === HYDRATION_START_ELSE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (server_rendered_pending) {
|
|
|
|
this.#hydrate_pending_content();
|
|
|
|
this.#hydrate_pending_content();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.#hydrate_resolved_content();
|
|
|
|
this.#hydrate_resolved_content();
|
|
|
@ -169,17 +169,6 @@ export class Boundary {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#detect_server_state() {
|
|
|
|
|
|
|
|
if (!hydrating || !this.#hydrate_open) return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const comment = this.#hydrate_open;
|
|
|
|
|
|
|
|
if (comment.nodeType === COMMENT_NODE) {
|
|
|
|
|
|
|
|
return /** @type {Comment} */ (comment).data === HYDRATION_START_ELSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#hydrate_resolved_content() {
|
|
|
|
#hydrate_resolved_content() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
this.#main_effect = branch(() => this.#children(this.#anchor));
|
|
|
|
this.#main_effect = branch(() => this.#children(this.#anchor));
|
|
|
@ -344,7 +333,7 @@ export class Boundary {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (hydrating) {
|
|
|
|
if (hydrating) {
|
|
|
|
set_hydrate_node(this.#hydrate_open);
|
|
|
|
set_hydrate_node(/** @type {TemplateNode} */ (this.#hydrate_open));
|
|
|
|
next();
|
|
|
|
next();
|
|
|
|
set_hydrate_node(remove_nodes());
|
|
|
|
set_hydrate_node(remove_nodes());
|
|
|
|
}
|
|
|
|
}
|
|
|
|