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

Co-authored-by: Elliott Johnson <sejohnson@torchcloudconsulting.com>
pull/15844/head
Rich Harris 2 months ago committed by GitHub
parent 36612abdd8
commit 0752833dbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,11 +15,9 @@ export function AwaitExpression(node, context) {
// preserve context for
// a) top-level await and
// b) awaits that precede other expressions in template or `$derived(...)`
if (tla || is_reactive_expression(context)) {
if (tla || !is_last_evaluated_expression(context, node)) {
if (tla || (is_reactive_expression(context) && !is_last_evaluated_expression(context, node))) {
return b.call(b.await(b.call('$.save', argument)));
}
}
}
// in dev, note which values are read inside a reactive expression,
// but don't track them

Loading…
Cancel
Save