aa-coordination
Rich Harris 7 months ago
parent 3763ff39af
commit 877a417c17

@ -124,19 +124,7 @@ export function boundary(node, props, children) {
});
}
// @ts-ignore We re-use the effect's fn property to avoid allocation of an additional field
boundary.fn = (/** @type {unknown} */ input, /** @type {() => void} */ payload) => {
if (input === ASYNC_INCREMENT) {
boundary.f |= BOUNDARY_SUSPENDED;
async_count++;
// TODO post-init, show the pending snippet after a timeout
return;
}
if (input === ASYNC_DECREMENT) {
if (--async_count === 0) {
function unsuspend() {
boundary.f ^= BOUNDARY_SUSPENDED;
run_all(callbacks);
@ -159,6 +147,22 @@ export function boundary(node, props, children) {
}
}
// @ts-ignore We re-use the effect's fn property to avoid allocation of an additional field
boundary.fn = (/** @type {unknown} */ input, /** @type {() => void} */ payload) => {
if (input === ASYNC_INCREMENT) {
boundary.f |= BOUNDARY_SUSPENDED;
async_count++;
// TODO post-init, show the pending snippet after a timeout
return;
}
if (input === ASYNC_DECREMENT) {
if (--async_count === 0) {
queue_boundary_micro_task(unsuspend);
}
return;
}

Loading…
Cancel
Save