start working on hydration

aaa
Rich Harris 8 months ago
parent 96942400bd
commit d33c8ae4fe

@ -205,7 +205,7 @@ export function build_attribute_value(value, context, memoize = (value) => value
return {
value: memoize(expression, chunk.metadata.expression),
has_state: chunk.metadata.expression.has_state
has_state: chunk.metadata.expression.has_state || chunk.metadata.expression.is_async
};
}

@ -217,7 +217,24 @@ export function boundary(node, props, boundary_fn) {
hydrate_next();
}
const pending = props.pending;
if (hydrating && pending) {
boundary_effect = branch(() => pending(anchor));
// ...now what? we need to start rendering `boundary_fn` offscreen,
// and either insert the resulting fragment (if nothing suspends)
// or keep the pending effect alive until it unsuspends.
// not exactly sure how to do that.
// future work: when we have some form of async SSR, we will
// need to use hydration boundary comments to report whether
// the pending or main block was rendered for a given
// boundary, and hydrate accordingly
} else {
boundary_effect = branch(() => boundary_fn(anchor));
}
reset_is_throwing_error();
}, EFFECT_TRANSPARENT | BOUNDARY_EFFECT);

Loading…
Cancel
Save