diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index 9fdaa0cbaaa0..c6eb1f1bb8f3 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -359,15 +359,11 @@ export default function dom( component.reactive_declarations .forEach(d => { - let uses_props; + const dependencies = Array.from(d.dependencies); + const uses_props = !!dependencies.find(n => n === '$$props'); - const condition = Array.from(d.dependencies) + const condition = !uses_props && dependencies .filter(n => { - if (n === '$$props') { - uses_props = true; - return false; - } - const variable = component.var_lookup.get(n); return variable && (variable.writable || variable.mutated); }) diff --git a/test/runtime/samples/props-reactive-b/_config.js b/test/runtime/samples/props-reactive-b/_config.js new file mode 100644 index 000000000000..43eaee23aa7e --- /dev/null +++ b/test/runtime/samples/props-reactive-b/_config.js @@ -0,0 +1,30 @@ +export default { + props: { + a: 1, + b: 2 + }, + + html: ` +

a: 1

+

b: 2

+

c: 3

+ `, + + async test({ assert, component, target }) { + await component.$set({ a: 4 }); + + assert.htmlEqual(target.innerHTML, ` +

a: 4

+

b: 2

+

c: 6

+ `); + + await component.$set({ b: 5 }); + + assert.htmlEqual(target.innerHTML, ` +

a: 4

+

b: 5

+

c: 9

+ `); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/props-reactive-b/main.svelte b/test/runtime/samples/props-reactive-b/main.svelte new file mode 100644 index 000000000000..45d6fc0cadce --- /dev/null +++ b/test/runtime/samples/props-reactive-b/main.svelte @@ -0,0 +1,8 @@ + + +

a: {a}

+

b: {$$props.b}

+

c: {c}

\ No newline at end of file