diff --git a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts
index be3d6d146d97..835e0b52ce88 100644
--- a/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts
+++ b/src/compiler/compile/render_dom/wrappers/InlineComponent/index.ts
@@ -347,8 +347,8 @@ export default class InlineComponentWrapper extends Wrapper {
}
const params = [x`#value`];
+ const args = [x`#value`];
if (contextual_dependencies.length > 0) {
- const args = [];
contextual_dependencies.forEach(name => {
params.push({
@@ -361,25 +361,30 @@ export default class InlineComponentWrapper extends Wrapper {
});
- block.chunks.init.push(b`
- function ${id}(#value) {
- ${callee}.call(null, #value, ${args});
- }
- `);
-
block.maintain_context = true; // TODO put this somewhere more logical
- } else {
- block.chunks.init.push(b`
- function ${id}(#value) {
- ${callee}.call(null, #value);
+ }
+
+ block.chunks.init.push(b`
+ function ${id}(#value) {
+ ${callee}(${args});
+ }
+ `);
+
+ let invalidate_binding = b`
+ ${lhs} = #value;
+ ${renderer.invalidate(dependencies[0])};
+ `;
+ if (binding.expression.node.type === 'MemberExpression') {
+ invalidate_binding = b`
+ if ($$self.$$.not_equal(${lhs}, #value)) {
+ ${invalidate_binding}
}
- `);
+ `;
}
const body = b`
function ${id}(${params}) {
- ${lhs} = #value;
- ${renderer.invalidate(dependencies[0])};
+ ${invalidate_binding}
}
`;
diff --git a/test/runtime/samples/component-binding-reactive-property-no-extra-call/Component.svelte b/test/runtime/samples/component-binding-reactive-property-no-extra-call/Component.svelte
new file mode 100644
index 000000000000..f180f10cd848
--- /dev/null
+++ b/test/runtime/samples/component-binding-reactive-property-no-extra-call/Component.svelte
@@ -0,0 +1,6 @@
+
+
+{value}{value2}
diff --git a/test/runtime/samples/component-binding-reactive-property-no-extra-call/_config.js b/test/runtime/samples/component-binding-reactive-property-no-extra-call/_config.js
new file mode 100644
index 000000000000..7027c1a4e4f8
--- /dev/null
+++ b/test/runtime/samples/component-binding-reactive-property-no-extra-call/_config.js
@@ -0,0 +1,5 @@
+export default {
+ async test({ assert, component }) {
+ assert.equal(component.object_updates, component.primitive_updates);
+ }
+};
diff --git a/test/runtime/samples/component-binding-reactive-property-no-extra-call/main.svelte b/test/runtime/samples/component-binding-reactive-property-no-extra-call/main.svelte
new file mode 100644
index 000000000000..9d52ed675f3b
--- /dev/null
+++ b/test/runtime/samples/component-binding-reactive-property-no-extra-call/main.svelte
@@ -0,0 +1,13 @@
+
+
+