|
|
@ -143,28 +143,37 @@ export function async_derived(fn, location) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
promise.then(
|
|
|
|
/**
|
|
|
|
(v) => {
|
|
|
|
* @param {any} value
|
|
|
|
prev = null;
|
|
|
|
* @param {unknown} error
|
|
|
|
|
|
|
|
* @param {boolean} errored
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
const handler = (value, error = undefined, errored = false) => {
|
|
|
|
|
|
|
|
prev = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((parent.f & DESTROYED) !== 0) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((parent.f & DESTROYED) !== 0) {
|
|
|
|
restore();
|
|
|
|
return;
|
|
|
|
from_async_derived = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (should_suspend) {
|
|
|
|
|
|
|
|
if (!ran) {
|
|
|
|
|
|
|
|
boundary.decrement();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
batch.decrement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
restore();
|
|
|
|
if (ran) batch.restore();
|
|
|
|
from_async_derived = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (should_suspend) {
|
|
|
|
if (errored) {
|
|
|
|
if (!ran) {
|
|
|
|
if (error !== STALE_REACTION) {
|
|
|
|
boundary.decrement();
|
|
|
|
handle_error(error, parent, null, parent.ctx);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
batch.decrement();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (ran) batch.restore();
|
|
|
|
internal_set(signal, value);
|
|
|
|
internal_set(signal, v);
|
|
|
|
|
|
|
|
if (ran) batch.flush();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (DEV && location !== undefined) {
|
|
|
|
if (DEV && location !== undefined) {
|
|
|
|
recent_async_deriveds.add(signal);
|
|
|
|
recent_async_deriveds.add(signal);
|
|
|
@ -176,27 +185,14 @@ export function async_derived(fn, location) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(e) => {
|
|
|
|
|
|
|
|
prev = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e !== STALE_REACTION) {
|
|
|
|
|
|
|
|
handle_error(e, parent, null, parent.ctx);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (should_suspend) {
|
|
|
|
if (ran) batch.flush();
|
|
|
|
if (!ran) {
|
|
|
|
};
|
|
|
|
boundary.decrement();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
batch.decrement();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ran) {
|
|
|
|
promise.then(
|
|
|
|
batch.restore();
|
|
|
|
(v) => handler(v),
|
|
|
|
batch.flush();
|
|
|
|
(e) => handler(null, e, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}, EFFECT_ASYNC | EFFECT_PRESERVED);
|
|
|
|
}, EFFECT_ASYNC | EFFECT_PRESERVED);
|
|
|
|
|
|
|
|
|
|
|
|