diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 0afb903b29..bf874bbbea 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -857,12 +857,14 @@ export default class Component { declaration.dependencies.forEach(name => { if (declaration.assignees.has(name)) return; const earlier_declarations = lookup.get(name); - if (earlier_declarations) earlier_declarations.forEach(add_declaration); + if (earlier_declarations) earlier_declarations.forEach(declaration => { + if (this.reactive_declarations.indexOf(declaration) === -1) { + add_declaration(declaration); + } + }); }); - if (this.reactive_declarations.indexOf(declaration) === -1) { - this.reactive_declarations.push(declaration); - } + this.reactive_declarations.push(declaration); }; unsorted_reactive_declarations.forEach(declaration => { diff --git a/test/runtime/samples/reactive-values-second-order/_config.js b/test/runtime/samples/reactive-values-second-order/_config.js new file mode 100644 index 0000000000..c1dee87e2c --- /dev/null +++ b/test/runtime/samples/reactive-values-second-order/_config.js @@ -0,0 +1,8 @@ +export default { + test({ assert, component, target }) { + assert.equal(component.qux, 2); + + component.foo = 2; + assert.equal(component.qux, 4); + } +}; diff --git a/test/runtime/samples/reactive-values-second-order/main.html b/test/runtime/samples/reactive-values-second-order/main.html new file mode 100644 index 0000000000..1d0e840c08 --- /dev/null +++ b/test/runtime/samples/reactive-values-second-order/main.html @@ -0,0 +1,12 @@ + \ No newline at end of file