Skip to content

Commit bcdddc6

Browse files
committed
fix member expressions for real
1 parent 994afaf commit bcdddc6

File tree

1 file changed

+9
-7
lines changed
  • packages/svelte/src/compiler/phases/3-transform/client/visitors/shared

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,15 @@ export function build_component(node, component_name, context, anchor = context.
176176
// When we have a non-simple computation, anything other than an Identifier or Member expression,
177177
// then there's a good chance it needs to be memoized to avoid over-firing when read within the
178178
// child component (e.g. `active={i === index}`)
179-
const should_wrap_in_derived = get_attribute_chunks(attribute.value).some((n) => {
180-
return (
181-
n.type === 'ExpressionTag' &&
182-
n.expression.type !== 'Identifier' &&
183-
n.expression.type !== 'MemberExpression'
184-
);
185-
});
179+
const should_wrap_in_derived =
180+
metadata.is_async ||
181+
get_attribute_chunks(attribute.value).some((n) => {
182+
return (
183+
n.type === 'ExpressionTag' &&
184+
n.expression.type !== 'Identifier' &&
185+
n.expression.type !== 'MemberExpression'
186+
);
187+
});
186188

187189
return should_wrap_in_derived
188190
? b.call(

0 commit comments

Comments
 (0)