fix, albeit one i don't fully understand

pull/16668/head
Rich Harris 3 weeks ago
parent 4e0c795ba7
commit e0c90fbc7d

@ -73,11 +73,13 @@ function capture() {
var previous_effect = active_effect;
var previous_reaction = active_reaction;
var previous_component_context = component_context;
var previous_batch = current_batch;
return function restore() {
set_active_effect(previous_effect);
set_active_reaction(previous_reaction);
set_component_context(previous_component_context);
previous_batch?.activate();
if (DEV) {
set_from_async_derived(null);
@ -176,8 +178,8 @@ export function unset_context() {
* @param {() => Promise<void>} fn
*/
export async function async_body(fn) {
const unsuspend = suspend();
const active = /** @type {Effect} */ (active_effect);
var unsuspend = suspend();
var active = /** @type {Effect} */ (active_effect);
try {
await fn();

@ -680,6 +680,10 @@ export function suspend() {
batch.decrement();
}
if (batch === current_batch) {
batch.deactivate();
}
unset_context();
};
}

Loading…
Cancel
Save