Skip to content

Commit

Permalink
fix #5427 - do not declare variable for member assignment in reactive…
Browse files Browse the repository at this point in the history
… declaration
  • Loading branch information
tanhauhau committed Aug 8, 2020
1 parent 1398aff commit bb6a1b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/compiler/compile/render_ssr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ export default function ssr(
? b`
${injected.map(name => b`let ${name};`)}
${statement}`
: b`
let ${left} = ${right}`;
: left.type === "Identifier"
? b`
let ${left} = ${right}`
: b`${left} = ${right}`;
}
} else { // TODO do not add label if it's not referenced
statement = b`$: { ${statement} }`;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
html: `
<h1>Hello world!</h1>
`,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
$: user = {};
$: user.name = 'world';
</script>

<h1>Hello {user.name}!</h1>

0 comments on commit bb6a1b6

Please sign in to comment.