Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Move 'Helmet.canUseDom' setting before actual rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
artkravchenko committed Apr 27, 2017
1 parent ec2abf9 commit 5bf9189
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server.js
Expand Up @@ -240,6 +240,9 @@ app.use(async function reactMiddleware(ctx) {
}

try {
// we always render Helmet's metadata as tags like <title></title>
Helmet.canUseDOM = false;

const html = renderToString(
<Provider store={store}>
<RouterContext {...renderProps} />
Expand All @@ -251,9 +254,7 @@ app.use(async function reactMiddleware(ctx) {
ctx.status = fetchHandler.status;
}

// we always render Helmet's metadata as tags like <title></title>
Helmet.canUseDOM = false;
const metadata = Helmet.rewind();
const metadata = Helmet.renderStatic();

// Actual status code is returned with fetchData()
// ctx.status = 200;
Expand Down

0 comments on commit 5bf9189

Please sign in to comment.