Skip to content

Commit d37ded8

Browse files
committed
simplify
1 parent ae23e25 commit d37ded8

File tree

1 file changed

+7
-18
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+7
-18
lines changed

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
set_current_reaction
1010
} from '../../runtime.js';
1111
import { destroy_effect, pause_effect, render_effect } from '../../reactivity/effects.js';
12-
import { DESTROYED, INERT } from '../../constants.js';
12+
import { INERT } from '../../constants.js';
1313

1414
/**
1515
* @template V
@@ -57,17 +57,6 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
5757
return effect;
5858
}
5959

60-
/** @param {import('#client').Effect} effect */
61-
function pause(effect) {
62-
if ((effect.f & DESTROYED) !== 0) return;
63-
const dom = effect.dom;
64-
65-
pause_effect(effect, () => {
66-
// TODO make this unnecessary
67-
if (dom !== null) remove(dom);
68-
});
69-
}
70-
7160
const branch = render_effect(() => {
7261
if (input === (input = get_input())) return;
7362

@@ -83,30 +72,30 @@ export function await_block(anchor, get_input, pending_fn, then_fn, catch_fn) {
8372
pending_effect = render_effect(() => pending_fn(anchor), true);
8473
}
8574

86-
if (then_effect) pause(then_effect);
87-
if (catch_effect) pause(catch_effect);
75+
if (then_effect) pause_effect(then_effect);
76+
if (catch_effect) pause_effect(catch_effect);
8877

8978
promise.then(
9079
(value) => {
9180
if (promise !== input) return;
92-
if (pending_effect) pause(pending_effect);
81+
if (pending_effect) pause_effect(pending_effect);
9382

9483
if (then_fn) {
9584
then_effect = create_effect(then_fn, value);
9685
}
9786
},
9887
(error) => {
9988
if (promise !== input) return;
100-
if (pending_effect) pause(pending_effect);
89+
if (pending_effect) pause_effect(pending_effect);
10190

10291
if (catch_fn) {
10392
catch_effect = create_effect(catch_fn, error);
10493
}
10594
}
10695
);
10796
} else {
108-
if (pending_effect) pause(pending_effect);
109-
if (catch_effect) pause(catch_effect);
97+
if (pending_effect) pause_effect(pending_effect);
98+
if (catch_effect) pause_effect(catch_effect);
11099

111100
if (then_fn) {
112101
if (then_effect) {

0 commit comments

Comments
 (0)