Skip to content

Commit

Permalink
small tweak to ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 25, 2016
1 parent d08cf7c commit a9ee5c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dev": "webpack --watch --config build/webpack.dist.dev.config.js",
"dev:test": "karma start build/karma.dev.config.js",
"dev:ssr": "webpack --watch --config build/webpack.ssr.dev.config.js",
"test": "npm run lint && npm run test:unit && npm run test:e2e",
"test": "npm run lint && npm run test:unit && npm run test:e2e && npm run test:ssr",
"build": "NODE_ENV=production node build/build.js",
"lint": "eslint src build test",
"test:unit": "karma start build/karma.unit.config.js",
Expand Down
5 changes: 3 additions & 2 deletions src/server/create-streaming-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export function createStreamingRenderer (modules, directives, isUnaryTag) {

function renderElement (el, write, next) {
const startTag = renderStartingTag(el, modules, directives)
const endTag = `</${el.tag}>`
if (isUnaryTag(el.tag)) {
write(startTag, next)
} else if (!el.children || !el.children.length) {
write(startTag + `</${el.tag}>`, next)
write(startTag + endTag, next)
} else {
write(startTag, () => {
const total = el.children.length
Expand All @@ -37,7 +38,7 @@ export function createStreamingRenderer (modules, directives, isUnaryTag) {
if (rendered < total) {
renderChild(el.children[rendered])
} else {
write(`</${el.tag}>`, next)
write(endTag, next)
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/render-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import stream from 'stream'
*/

export default class RenderStream extends stream.Readable {
constructor (render, options) {
super(options)
constructor (render) {
super()
this.buffer = ''
this.render = render
this.maxStackDepth = 500
Expand Down

0 comments on commit a9ee5c9

Please sign in to comment.