aa-fork
Rich Harris 8 months ago
parent 5294730486
commit 51a3d1e4bd

@ -70,11 +70,11 @@ export function if_block(node, fn, elseif = false) {
active_fork.f ^= FORK_ROOT; active_fork.f ^= FORK_ROOT;
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
const offscreen_condition = condition;
const offscreen_anchor = document.createComment(''); const offscreen_anchor = document.createComment('');
fragment.append(offscreen_anchor); fragment.append(offscreen_anchor);
try {
const offscreen_effect = fn && branch(() => fn(offscreen_anchor)); const offscreen_effect = fn && branch(() => fn(offscreen_anchor));
active_fork.branches.push(() => { active_fork.branches.push(() => {
@ -106,6 +106,9 @@ export function if_block(node, fn, elseif = false) {
} }
} }
}); });
} finally {
active_fork.f |= FORK_ROOT;
}
return; return;
} }

@ -145,6 +145,10 @@ export function fork(fn) {
flush_sync(); flush_sync();
revert(active_fork); revert(active_fork);
if (f.pending === 0) {
f.callback();
}
}); });
} finally { } finally {
active_fork = null; active_fork = null;

Loading…
Cancel
Save