From 0e0da70917f5d1487c10d0848d4dbac1f5329885 Mon Sep 17 00:00:00 2001 From: Emil Tholin Date: Tue, 30 Apr 2019 22:56:47 +0200 Subject: [PATCH] Check 'injected' and 'fixed_reactive_declarations' independently --- src/compile/render-dom/index.ts | 5 +++-- test/runtime/samples/reactive-values-fixed/_config.js | 11 +++++++++++ .../runtime/samples/reactive-values-fixed/main.svelte | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test/runtime/samples/reactive-values-fixed/_config.js create mode 100644 test/runtime/samples/reactive-values-fixed/main.svelte diff --git a/src/compile/render-dom/index.ts b/src/compile/render-dom/index.ts index a6ef0ac69c..af33a5b2f0 100644 --- a/src/compile/render-dom/index.ts +++ b/src/compile/render-dom/index.ts @@ -423,14 +423,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)}; } diff --git a/test/runtime/samples/reactive-values-fixed/_config.js b/test/runtime/samples/reactive-values-fixed/_config.js new file mode 100644 index 0000000000..58aee09c35 --- /dev/null +++ b/test/runtime/samples/reactive-values-fixed/_config.js @@ -0,0 +1,11 @@ +export default { + html: ` +

4

+ `, + + test({ assert, component, target }) { + assert.htmlEqual(target.innerHTML, ` +

4

+ `); + } +}; diff --git a/test/runtime/samples/reactive-values-fixed/main.svelte b/test/runtime/samples/reactive-values-fixed/main.svelte new file mode 100644 index 0000000000..53445e03ba --- /dev/null +++ b/test/runtime/samples/reactive-values-fixed/main.svelte @@ -0,0 +1,6 @@ + + +

{squared}