chore: remove `async_body` (#17425)

* chore: remove unused async_body

* unused
pull/17428/head
Rich Harris 4 months ago committed by GitHub
parent 37f08493c9
commit 1482ae8726
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -98,7 +98,6 @@ export {
with_script
} from './dom/template.js';
export {
async_body,
for_await_track_reactivity_loss,
run,
save,

@ -25,7 +25,6 @@ import {
set_from_async_derived
} from './deriveds.js';
import { aborted } from './effects.js';
import { hydrate_next, hydrating, set_hydrate_node, skip_nodes } from '../dom/hydration.js';
/**
* @param {Array<Promise<void>>} blockers
@ -211,51 +210,6 @@ export function unset_context() {
}
}
/**
* @param {TemplateNode} anchor
* @param {(target: TemplateNode) => Promise<void>} fn
*/
export async function async_body(anchor, fn) {
var boundary = get_boundary();
var batch = /** @type {Batch} */ (current_batch);
var blocking = !boundary.is_pending();
boundary.update_pending_count(1);
batch.increment(blocking);
var active = /** @type {Effect} */ (active_effect);
var was_hydrating = hydrating;
var next_hydrate_node = undefined;
if (was_hydrating) {
hydrate_next();
next_hydrate_node = skip_nodes(false);
}
try {
var promise = fn(anchor);
} finally {
if (next_hydrate_node) {
set_hydrate_node(next_hydrate_node);
hydrate_next();
}
}
try {
await promise;
} catch (error) {
if (!aborted(active)) {
invoke_error_boundary(error, active);
}
} finally {
boundary.update_pending_count(-1);
batch.decrement(blocking);
unset_context();
}
}
/**
* @param {Array<() => void | Promise<void>>} thunks
*/

Loading…
Cancel
Save