|
|
|
@ -17,12 +17,15 @@ import { async_derived, derived, derived_safe_equal } from './deriveds.js';
|
|
|
|
|
export function flatten(sync, async, fn) {
|
|
|
|
|
const d = is_runes() ? derived : derived_safe_equal;
|
|
|
|
|
|
|
|
|
|
if (async.length > 0) {
|
|
|
|
|
if (async.length === 0) {
|
|
|
|
|
fn(sync.map(d));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var batch = current_batch;
|
|
|
|
|
var parent = /** @type {Effect} */ (active_effect);
|
|
|
|
|
|
|
|
|
|
var restore = capture();
|
|
|
|
|
|
|
|
|
|
var boundary = get_pending_boundary();
|
|
|
|
|
|
|
|
|
|
Promise.all(async.map((expression) => async_derived(expression)))
|
|
|
|
@ -45,7 +48,4 @@ export function flatten(sync, async, fn) {
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
boundary.error(error);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
fn(sync.map(d));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|