Skip to content

Commit

Permalink
fix(ssr): should not optimize root if conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 authored and lovelope committed Feb 1, 2018
1 parent 5f85350 commit 9175a1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/optimizing-compiler/optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function walk (node: ASTNode, isRoot?: boolean) {
if (node.ifConditions) {
for (let i = 1, l = node.ifConditions.length; i < l; i++) {
const block = node.ifConditions[i].block
walk(block)
walk(block, isRoot)
check(block)
}
}
Expand Down
11 changes: 11 additions & 0 deletions test/ssr/ssr-string.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,17 @@ describe('SSR: renderToString', () => {
done()
})
})

// #6907
it('should not optimize root if conditions', done => {
renderVmWithOptions({
data: { foo: 123 },
template: `<input :type="'text'" v-model="foo">`
}, res => {
expect(res).toBe(`<input type="text" data-server-rendered="true" value="123">`)
done()
})
})
})

function renderVmWithOptions (options, cb) {
Expand Down

0 comments on commit 9175a1e

Please sign in to comment.