remove kludge

pull/16971/head
Rich Harris 1 month ago
parent d8df737f56
commit c054cd4f3f

@ -1,5 +1,6 @@
/** @import { TemplateNode, Value } from '#client' */ /** @import { TemplateNode, Value } from '#client' */
import { flatten } from '../../reactivity/async.js'; import { flatten } from '../../reactivity/async.js';
import { Batch, current_batch } from '../../reactivity/batch.js';
import { get } from '../../runtime.js'; import { get } from '../../runtime.js';
import { import {
hydrate_next, hydrate_next,
@ -18,8 +19,12 @@ import { get_boundary } from './boundary.js';
*/ */
export function async(node, expressions, fn) { export function async(node, expressions, fn) {
var boundary = get_boundary(); var boundary = get_boundary();
var batch = /** @type {Batch} */ (current_batch);
var blocking = !boundary.is_pending();
boundary.update_pending_count(1); boundary.update_pending_count(1);
batch.increment(blocking);
var was_hydrating = hydrating; var was_hydrating = hydrating;
@ -44,6 +49,7 @@ export function async(node, expressions, fn) {
fn(node, ...values); fn(node, ...values);
} finally { } finally {
boundary.update_pending_count(-1); boundary.update_pending_count(-1);
batch.decrement(blocking);
} }
if (was_hydrating) { if (was_hydrating) {

@ -285,13 +285,6 @@ export class Boundary {
this.#anchor.before(this.#offscreen_fragment); this.#anchor.before(this.#offscreen_fragment);
this.#offscreen_fragment = null; this.#offscreen_fragment = null;
} }
// TODO this feels like a little bit of a kludge, but until we
// overhaul the boundary/batch relationship it's probably
// the most pragmatic solution available to us
queue_micro_task(() => {
Batch.ensure().flush();
});
} }
} }

Loading…
Cancel
Save