diff options
Diffstat (limited to 'vnext/server')
-rw-r--r-- | vnext/server/middleware/renderer.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vnext/server/middleware/renderer.js b/vnext/server/middleware/renderer.js index a4b745f8..ca2ac2df 100644 --- a/vnext/server/middleware/renderer.js +++ b/vnext/server/middleware/renderer.js @@ -7,6 +7,7 @@ import App from '../../src/App'; import { getLinks } from '../sape'; import { StaticRouter } from 'react-router-dom/server'; +import { VisitorProvider } from '../../src/ui/VisitorContext'; const path = require('path'); const fs = require('fs'); @@ -49,9 +50,11 @@ const serverRenderer = async (req, res) => { const propsData = `<script>window.__PROPS__="${toBinary(JSON.stringify(props))}";</script>${marker}`; let didError = false; const { pipe } = ReactDOMServer.renderToPipeableStream( - <StaticRouter location={req.baseUrl} context={routerContext}> - <App {...props} /> - </StaticRouter> + <VisitorProvider> + <StaticRouter location={req.baseUrl} context={routerContext}> + <App {...props} /> + </StaticRouter> + </VisitorProvider> , { onShellReady() { res.statusCode = didError ? 500 : 200; |