Skip to content

Commit 82fe944

Browse files
committed
tidy up
1 parent 3a1820d commit 82fe944

File tree

2 files changed

+9
-16
lines changed
  • packages/svelte
    • src/internal/client/dom/blocks
    • tests/runtime-runes/samples/await-pending-destroy

2 files changed

+9
-16
lines changed

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

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1-
/** @import { Effect, Source, TemplateNode } from '#client' */
2-
import { DEV } from 'esm-env';
1+
/** @import { Source, TemplateNode } from '#client' */
32
import { is_promise } from '../../../shared/utils.js';
4-
import { block, branch, pause_effect, resume_effect } from '../../reactivity/effects.js';
3+
import { block } from '../../reactivity/effects.js';
54
import { internal_set, mutable_source, source } from '../../reactivity/sources.js';
6-
import { set_active_effect, set_active_reaction } from '../../runtime.js';
75
import {
86
hydrate_next,
9-
hydrate_node,
107
hydrating,
118
skip_nodes,
129
set_hydrate_node,
1310
set_hydrating
1411
} from '../hydration.js';
1512
import { queue_micro_task } from '../task.js';
16-
import { HYDRATION_START_ELSE, UNINITIALIZED } from '../../../../constants.js';
17-
import {
18-
component_context,
19-
dev_stack,
20-
is_runes,
21-
set_component_context,
22-
set_dev_current_component_function,
23-
set_dev_stack
24-
} from '../../context.js';
13+
import { HYDRATION_START_ELSE } from '../../../../constants.js';
14+
import { is_runes } from '../../context.js';
2515
import { flushSync, is_flushing_sync } from '../../reactivity/batch.js';
2616
import { BranchManager } from './branches.js';
2717
import { capture, unset_context } from '../../reactivity/async.js';
@@ -142,6 +132,8 @@ export function await_block(node, get_input, pending_fn, then_fn, catch_fn) {
142132
set_hydrating(true);
143133
}
144134

145-
return () => (destroyed = true);
135+
return () => {
136+
destroyed = true;
137+
};
146138
});
147139
}

packages/svelte/tests/runtime-runes/samples/await-pending-destroy/_config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { tick } from 'svelte';
12
import { test } from '../../test';
23

34
/**
@@ -77,7 +78,7 @@ export default test({
7778
const { promise, reject } = promiseWithResolver();
7879
component.promise = promise;
7980
// wait for rendering
80-
await Promise.resolve();
81+
await tick();
8182

8283
// remove the promise
8384
component.promise = null;

0 commit comments

Comments
 (0)