Skip to content

Commit 53137a1

Browse files
committed
dry out
1 parent 97f8110 commit 53137a1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ export function build_attribute_effect(
8989
all.map(({ id }) => id),
9090
b.object(values)
9191
),
92-
memoizer.sync.length > 0 &&
93-
b.array(memoizer.sync.map(({ expression }) => b.thunk(expression))),
92+
memoizer.sync_values(),
9493
memoizer.async_values(),
9594
element.metadata.scoped &&
9695
context.state.analysis.css.hash !== '' &&

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export class Memoizer {
5353
if (this.async.length === 0) return;
5454
return b.array(this.async.map((memo) => b.thunk(memo.expression, true)));
5555
}
56+
57+
sync_values() {
58+
if (this.sync.length === 0) return;
59+
return b.array(this.sync.map((memo) => b.thunk(memo.expression)));
60+
}
5661
}
5762

5863
/**
@@ -169,7 +174,7 @@ export function build_render_statement(state) {
169174
? state.update[0].expression
170175
: b.block(state.update)
171176
),
172-
all.length > 0 && b.array(memoizer.sync.map(({ expression }) => b.thunk(expression))),
177+
memoizer.sync_values(),
173178
memoizer.async_values()
174179
)
175180
);

0 commit comments

Comments
 (0)