Skip to content

Commit 3f56275

Browse files
committed
fix?
1 parent 3d05265 commit 3f56275

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ export function client_component(analysis, options) {
370370
.../** @type {ESTree.Statement[]} */ (template.body)
371371
]);
372372

373+
if (needs_store_cleanup) {
374+
body.body.push(b.stmt(b.call('$$cleanup')));
375+
}
376+
373377
component_block.body.push(b.stmt(b.call(`$.async_body`, b.arrow([], body, true))));
374378
} else {
375379
component_block.body.push(
@@ -452,11 +456,12 @@ export function client_component(analysis, options) {
452456
component_block.body.push(to_push);
453457
}
454458

455-
if (needs_store_cleanup) {
459+
if (needs_store_cleanup && !analysis.instance.has_await) {
456460
component_block.body.push(b.stmt(b.call('$$cleanup')));
457-
if (component_returned_object.length > 0) {
458-
component_block.body.push(b.return(b.id('$$pop')));
459-
}
461+
}
462+
463+
if (needs_store_cleanup && component_returned_object.length > 0) {
464+
component_block.body.push(b.return(b.id('$$pop')));
460465
}
461466

462467
if (analysis.uses_rest_props) {

0 commit comments

Comments
 (0)