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 aJean committed Aug 19, 2020
1 parent ff7b52d commit 5cc603e
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
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
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 5cc603e

Please sign in to comment.