Skip to content

Commit

Permalink
tentative fix for macros broken by $capture_state
Browse files Browse the repository at this point in the history
  • Loading branch information
rixo committed Feb 29, 2020
1 parent f305354 commit 989803d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compiler/compile/render_dom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ export default function dom(
const capturable_vars = component.vars.filter(v => !v.internal && !v.global && !v.name.startsWith('$$'));

if (capturable_vars.length > 0) {
capture_state = x`() => ({ ${capturable_vars.map(prop => p`${prop.name}`)} })`;
capture_state = x`() => ({ ${
capturable_vars.map(prop => `'${prop.name.replace("'", "\\'")}': ${prop.name}`).join(', ')
} })`;
}

const injectable_vars = capturable_vars.filter(v => !v.module && v.writable && v.name[0] !== '$');
Expand Down

0 comments on commit 989803d

Please sign in to comment.