Skip to content

Commit

Permalink
Move nextdata into nextScript and make Main return a single el (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnewmannn authored and arunoda committed Jan 20, 2017
1 parent 5be9c04 commit c215311
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions server/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,8 @@ export class Main extends Component {
}

render () {
const { html, __NEXT_DATA__, staticMarkup } = this.context._documentProps
return <div>
<div id='__next' dangerouslySetInnerHTML={{ __html: html }} />
{staticMarkup ? null : <script dangerouslySetInnerHTML={{
__html: `__NEXT_DATA__ = ${htmlescape(__NEXT_DATA__)}; module={};`
}} />}
</div>
const { html } = this.context._documentProps
return <div id='__next' dangerouslySetInnerHTML={{ __html: html }} />
}
}

Expand All @@ -89,6 +84,9 @@ export class NextScript extends Component {
let { buildId } = __NEXT_DATA__

return <div>
{staticMarkup ? null : <script dangerouslySetInnerHTML={{
__html: `__NEXT_DATA__ = ${htmlescape(__NEXT_DATA__)}; module={};`
}} />}
{ staticMarkup ? null : <script type='text/javascript' src={`/_next/${buildId}/commons.js`} /> }
{ staticMarkup ? null : <script type='text/javascript' src={`/_next/${buildId}/main.js`} /> }
</div>
Expand Down

0 comments on commit c215311

Please sign in to comment.