Skip to content

Commit 64e4a4b

Browse files
committed
tweak
1 parent ed237a6 commit 64e4a4b

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -271,21 +271,14 @@ export function VariableDeclaration(node, context) {
271271
context.state.transform[id.name] = { read: get_value };
272272

273273
const expression = /** @type {Expression} */ (context.visit(b.thunk(value)));
274-
const call = b.call('$.derived', expression);
275-
declarations.push(
276-
b.declarator(
277-
id,
278-
dev
279-
? b.call(
280-
'$.tag',
281-
call,
282-
b.literal(
283-
`[$derived ${declarator.id.type === 'ArrayPattern' ? 'iterable' : 'object'}]`
284-
)
285-
)
286-
: call
287-
)
288-
);
274+
let call = b.call('$.derived', expression);
275+
276+
if (dev) {
277+
const label = `[$derived ${declarator.id.type === 'ArrayPattern' ? 'iterable' : 'object'}]`;
278+
call = b.call('$.tag', call, b.literal(label));
279+
}
280+
281+
declarations.push(b.declarator(id, call));
289282
}
290283

291284
for (const path of paths) {

0 commit comments

Comments
 (0)