pull/17165/head
Simon Holthausen 3 days ago
parent 31a239833e
commit b73a22849f

@ -48,7 +48,11 @@ export function SvelteBoundary(node, context) {
if (child.type === 'ConstTag') {
has_const = true;
if (!context.state.options.experimental.async) {
context.visit(child, { ...context.state, consts: const_tags });
context.visit(child, {
...context.state,
consts: const_tags,
scope: context.state.scopes.get(node.fragment) ?? context.state.scope
});
}
}
}

@ -25,20 +25,23 @@ export default function Async_in_derived($$anchor, $$props) {
{
var consequent = ($$anchor) => {
$.async_body($$anchor, async ($$anchor) => {
const yes1 = (await $.save($.async_derived(async () => (await $.save(1))())))();
const yes2 = (await $.save($.async_derived(async () => foo((await $.save(1))()))))();
let yes1;
let yes2;
let no1;
let no2;
const no1 = $.derived(() => (async () => {
return await 1;
})());
var promises = $.run([
async () => yes1 = (await $.save($.async_derived(async () => (await $.save(1))())))(),
async () => yes2 = (await $.save($.async_derived(async () => foo((await $.save(1))()))))(),
const no2 = $.derived(() => (async () => {
() => no1 = $.derived(() => (async () => {
return await 1;
})());
})()),
if ($.aborted()) return;
});
() => no2 = $.derived(() => (async () => {
return await 1;
})())
]);
};
$.if(node, ($$render) => {

@ -18,24 +18,38 @@ export default function Async_in_derived($$renderer, $$props) {
}
]);
$$renderer.async_block([], async ($$renderer) => {
if (true) {
$$renderer.push('<!--[-->');
const yes1 = (await $.save(1))();
const yes2 = foo((await $.save(1))());
const no1 = (async () => {
return await 1;
})();
const no2 = (async () => {
return await 1;
})();
} else {
$$renderer.push('<!--[!-->');
}
});
if (true) {
$$renderer.push('<!--[-->');
let yes1;
let yes2;
let no1;
let no2;
var promises = $$renderer.run([
async () => {
yes1 = (await $.save(1))();
},
async () => {
yes2 = foo((await $.save(1))());
},
() => {
no1 = (async () => {
return await 1;
})();
},
() => {
no2 = (async () => {
return await 1;
})();
}
]);
} else {
$$renderer.push('<!--[!-->');
}
$$renderer.push(`<!--]-->`);
});

Loading…
Cancel
Save