Skip to content

Commit c054cd4

Browse files
committed
remove kludge
1 parent d8df737 commit c054cd4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/svelte/src/internal/client/dom/blocks/async.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @import { TemplateNode, Value } from '#client' */
22
import { flatten } from '../../reactivity/async.js';
3+
import { Batch, current_batch } from '../../reactivity/batch.js';
34
import { get } from '../../runtime.js';
45
import {
56
hydrate_next,
@@ -18,8 +19,12 @@ import { get_boundary } from './boundary.js';
1819
*/
1920
export function async(node, expressions, fn) {
2021
var boundary = get_boundary();
22+
var batch = /** @type {Batch} */ (current_batch);
23+
24+
var blocking = !boundary.is_pending();
2125

2226
boundary.update_pending_count(1);
27+
batch.increment(blocking);
2328

2429
var was_hydrating = hydrating;
2530

@@ -44,6 +49,7 @@ export function async(node, expressions, fn) {
4449
fn(node, ...values);
4550
} finally {
4651
boundary.update_pending_count(-1);
52+
batch.decrement(blocking);
4753
}
4854

4955
if (was_hydrating) {

packages/svelte/src/internal/client/dom/blocks/boundary.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,6 @@ export class Boundary {
285285
this.#anchor.before(this.#offscreen_fragment);
286286
this.#offscreen_fragment = null;
287287
}
288-
289-
// TODO this feels like a little bit of a kludge, but until we
290-
// overhaul the boundary/batch relationship it's probably
291-
// the most pragmatic solution available to us
292-
queue_micro_task(() => {
293-
Batch.ensure().flush();
294-
});
295288
}
296289
}
297290

0 commit comments

Comments
 (0)