prevent cyclical dependency detection false positives

pull/1839/head
Rich Harris 7 years ago
parent ba5c3ce574
commit d92fb12086

@ -857,12 +857,14 @@ export default class Component {
declaration.dependencies.forEach(name => { declaration.dependencies.forEach(name => {
if (declaration.assignees.has(name)) return; if (declaration.assignees.has(name)) return;
const earlier_declarations = lookup.get(name); 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 => { unsorted_reactive_declarations.forEach(declaration => {

@ -0,0 +1,8 @@
export default {
test({ assert, component, target }) {
assert.equal(component.qux, 2);
component.foo = 2;
assert.equal(component.qux, 4);
}
};

@ -0,0 +1,12 @@
<script>
export let foo = 1, bar, baz, qux;
$: {
bar = foo;
baz = foo;
}
$: {
qux = bar + baz;
}
</script>
Loading…
Cancel
Save