fix instrumentation of auto-subscription self-assignments (#2681)

pull/2683/head
Conduitry 5 years ago
parent 52633542e6
commit fc5727c187

@ -182,7 +182,7 @@ export default function dom(
if (node.operator === '=' && nodes_match(node.left, node.right)) {
const dirty = names.filter(name => {
return scope.find_owner(name) === component.instance_scope;
return name[0] === '$' || scope.find_owner(name) === component.instance_scope;
});
if (dirty.length) component.has_reactive_assignments = true;

@ -0,0 +1,8 @@
export default {
html: `[]`,
async test({ assert, component, target }) {
await component.go();
assert.htmlEqual(target.innerHTML, `[42]`);
}
};

@ -0,0 +1,11 @@
<script>
import { writable } from 'svelte/store';
const foo = writable([]);
$: bar = $foo;
export function go() {
$foo.push(42);
$foo = $foo;
}
</script>
{JSON.stringify(bar)}
Loading…
Cancel
Save