Skip to content

Commit c8e47cc

Browse files
committed
tidy
1 parent cd24e51 commit c8e47cc

File tree

4 files changed

+7
-22
lines changed

4 files changed

+7
-22
lines changed
Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
/** @import { Effect, TemplateNode, Value } from '#client' */
2-
/** @import { Batch } from '../../reactivity/batch.js' */
1+
/** @import { TemplateNode, Value } from '#client' */
32
import { async_derived } from '../../reactivity/deriveds.js';
4-
import { current_batch } from '../../reactivity/batch.js';
5-
import { active_effect, schedule_effect } from '../../runtime.js';
63
import { capture, get_pending_boundary } from './boundary.js';
74

85
/**
@@ -13,26 +10,15 @@ import { capture, get_pending_boundary } from './boundary.js';
1310
export function async(node, expressions, fn) {
1411
// TODO handle hydration
1512

16-
var batch = /** @type {Batch} */ (current_batch);
17-
var effect = /** @type {Effect} */ (active_effect);
18-
19-
var boundary = get_pending_boundary(effect);
20-
var ran = boundary.ran;
21-
2213
var restore = capture();
14+
var boundary = get_pending_boundary();
2315

2416
boundary.increment();
2517

2618
Promise.all(expressions.map((fn) => async_derived(fn))).then((result) => {
27-
if (ran) batch.restore();
28-
2919
restore();
3020
fn(node, ...result);
3121

32-
// TODO is this necessary?
33-
schedule_effect(effect);
34-
35-
if (ran) batch.flush();
3622
boundary.decrement();
3723
});
3824
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,8 @@ function move_effect(effect, fragment) {
327327
}
328328
}
329329

330-
/** @param {Effect} effect */
331-
export function get_pending_boundary(effect) {
332-
let boundary = effect.b;
330+
export function get_pending_boundary() {
331+
var boundary = /** @type {Effect} */ (active_effect).b;
333332

334333
while (boundary !== null && !boundary.has_pending_snippet()) {
335334
boundary = boundary.parent;
@@ -367,7 +366,7 @@ export function capture(track = true) {
367366

368367
// TODO we should probably be incrementing the current batch, not the boundary?
369368
export function suspend() {
370-
let boundary = get_pending_boundary(/** @type {Effect} */ (active_effect));
369+
let boundary = get_pending_boundary();
371370

372371
boundary.increment();
373372

packages/svelte/src/internal/client/reactivity/deriveds.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function async_derived(fn, location) {
104104
throw new Error('TODO cannot create unowned async derived');
105105
}
106106

107-
let boundary = get_pending_boundary(parent);
107+
let boundary = get_pending_boundary();
108108

109109
var promise = /** @type {Promise<V>} */ (/** @type {unknown} */ (undefined));
110110
var signal = source(/** @type {V} */ (UNINITIALIZED));

packages/svelte/src/internal/client/reactivity/effects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export function template_effect(fn, sync = [], async = [], d = derived) {
346346
var batch = /** @type {Batch} */ (current_batch);
347347
var restore = capture();
348348

349-
var boundary = get_pending_boundary(parent);
349+
var boundary = get_pending_boundary();
350350
var ran = boundary.ran;
351351

352352
Promise.all(async.map((expression) => async_derived(expression))).then((result) => {

0 commit comments

Comments
 (0)