Skip to content

Commit 8a7391c

Browse files
committed
tweak
1 parent 58283de commit 8a7391c

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

packages/svelte/src/compiler/phases/3-transform/client/transform-client.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ export function client_component(analysis, options) {
355355
component_returned_object.push(b.spread(b.call(b.id('$.legacy_api'))));
356356
}
357357

358-
const push_args = [b.id('$$props'), b.literal(analysis.runes)];
358+
const push_args = [
359+
b.id('$$props'),
360+
b.literal(analysis.runes),
361+
b.literal(analysis.instance.has_await)
362+
];
359363
if (dev) push_args.push(b.id(analysis.name));
360364

361365
let component_block = b.block([
@@ -368,7 +372,8 @@ export function client_component(analysis, options) {
368372
dev ||
369373
analysis.needs_context ||
370374
analysis.reactive_statements.size > 0 ||
371-
component_returned_object.length > 0;
375+
component_returned_object.length > 0 ||
376+
analysis.instance.has_await;
372377

373378
if (analysis.instance.has_await) {
374379
if (should_inject_context && component_returned_object.length > 0) {

packages/svelte/src/internal/client/context.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,16 @@ export function getAllContexts() {
139139
/**
140140
* @param {Record<string, unknown>} props
141141
* @param {any} runes
142+
* @param {boolean} [has_async_body]
142143
* @param {Function} [fn]
143144
* @returns {void}
144145
*/
145-
export function push(props, runes = false, fn) {
146+
export function push(props, runes = false, has_async_body = false, fn) {
146147
component_context = {
147148
p: component_context,
148149
c: null,
149150
e: null,
150-
a: false,
151+
a: has_async_body,
151152
s: props,
152153
x: null,
153154
l: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ export async function async_body(fn, is_component = false) {
182182
var unsuspend = suspend();
183183
var active = /** @type {Effect} */ (active_effect);
184184
var ctx = is_component ? component_context : null;
185-
if (ctx !== null) {
186-
ctx.a = true;
187-
}
188185

189186
try {
190187
await fn();

0 commit comments

Comments
 (0)