Skip to content

Commit

Permalink
Fix missing tracking code in rendered HTML
Browse files Browse the repository at this point in the history
`onRenderBody` does take any return type, I removed the useless `return null` at the end of this function.
`setHeadComponents` doesn't return anything so the right side of the `&&` wasn't executed, only the `head` was built.
  • Loading branch information
julien1619 authored Jun 13, 2019
1 parent 57092e5 commit 12a3464
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,10 @@ exports.onRenderBody = (
(process.env.NODE_ENV === 'production' || pluginOptions.dev === true) &&
!isPathExcluded
) {
return (
setHeadComponents([buildHead(pluginOptions)]) &&
setPostBodyComponents([
buildTrackingCode(pluginOptions),
buildTrackingCodeNoJs(pluginOptions, pathname)
])
)
setHeadComponents([buildHead(pluginOptions)])
setPostBodyComponents([
buildTrackingCode(pluginOptions),
buildTrackingCodeNoJs(pluginOptions, pathname)
])
}
return null
}

0 comments on commit 12a3464

Please sign in to comment.