Merge pull request #2631 from EmilTholin/reactive-values-fixed

Check 'injected' and 'fixed_reactive_declarations' independently
pull/2670/head
Rich Harris 5 years ago committed by GitHub
commit 1eca19f371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -413,14 +413,15 @@ export default function dom(
${set && `$$self.$set = ${set};`}
${reactive_declarations.length > 0 && deindent`
${injected.length && `let ${injected.join(', ')};`}
${reactive_declarations.length > 0 && deindent`
$$self.$$.update = ($$dirty = { ${Array.from(all_reactive_dependencies).map(n => `${n}: 1`).join(', ')} }) => {
${reactive_declarations}
};
`}
${fixed_reactive_declarations}
`}
return ${stringify_props(filtered_declarations)};
}

@ -0,0 +1,11 @@
export default {
html: `
<p>4</p>
`,
test({ assert, component, target }) {
assert.htmlEqual(target.innerHTML, `
<p>4</p>
`);
}
};

@ -0,0 +1,6 @@
<script>
const num = 2;
$: squared = num * num;
</script>
<p>{squared}</p>
Loading…
Cancel
Save