From ef4a077a51a832108ff2ea9f93df857b1bf84477 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 21 May 2026 10:30:57 -0400 Subject: [PATCH] fix --- .../client/visitors/VariableDeclaration.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js index dffa79cd7a..72685a8e83 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js @@ -194,11 +194,6 @@ export function VariableDeclaration(node, context) { /** @type {CallExpression} */ (init) ); - // for now, only wrap async derived in $.save if it's not - // a top-level instance derived. TODO in future maybe we - // can dewaterfall all of them? - const should_save = context.state.is_instance && context.state.scope.function_depth > 1; - if (declarator.id.type === 'Identifier') { let expression = /** @type {Expression} */ (context.visit(value)); @@ -213,9 +208,7 @@ export function VariableDeclaration(node, context) { location ? b.literal(location) : undefined ); - call = should_save ? save(call) : b.await(call); - - declarations.push(b.declarator(declarator.id, call)); + declarations.push(b.declarator(declarator.id, b.await(call))); } else { if (rune === '$derived') expression = b.thunk(expression); @@ -251,7 +244,7 @@ export function VariableDeclaration(node, context) { location ? b.literal(location) : undefined ); - call = should_save ? save(call) : b.await(call); + call = b.await(call); } declarations.push(b.declarator(id, call));