From f06bc2fff7916fbeebfba6f94fa3341c8d89a8bf Mon Sep 17 00:00:00 2001 From: Axelen123 Date: Fri, 28 Jun 2019 18:31:04 +0200 Subject: [PATCH] Make inject_state and capture_state always available --- src/compiler/compile/render_dom/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index 4274d233eb..fe4c43c5fe 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -156,7 +156,11 @@ export default function dom( () => { return { ${component.vars.filter(prop => prop.writable).map(prop => prop.name).join(", ")} }; } - ` : null; + ` : deindent` + () => { + return {} + } + `; inject_state = (uses_props || writable_props.length > 0) ? deindent` ${$$props} => { @@ -165,7 +169,11 @@ export default function dom( if ('${prop.name}' in $$props) ${component.invalidate(prop.name, `${prop.name} = ${$$props}.${prop.name}`)}; `)} } - ` : null; + ` : deindent` + ${$$props} => { + return + } + `; } // instrument assignments