Next.js: Combining _document with redux connect or apollo

Created on 15 May 2017  路  8Comments  路  Source: vercel/next.js

I am trying to combine one of the style examples with-aphrodite and with-apollo-and-redux
It seems that _document.js does not work along with the withData wrapper as expected.

Cannot automatically buffer without a document Error: Cannot automatically buffer without a document at injectGeneratedCSSOnce (/Users/Max/Development/testrepo/node_modules/aphrodite/lib/inject.js:168:19) at injectStyleOnce (/Users/Max/Development/testrepo/node_modules/aphrodite/lib/inject.js:194:5) at injectAndGetClassName (/Users/Max/Development/testrepo/node_modules/aphrodite/lib/inject.js:287:5) at css (/Users/Max/Development/testrepo/node_modules/aphrodite/lib/exports.js:146:54) at exports.default (/Users/Max/Development/testrepo/.next/dist/components/layout/configuration/Languages.js:44:34) at walkTree (/Users/Max/Development/testrepo/node_modules/react-apollo/lib/server.js:34:21) at walkTree (/Users/Max/Development/testrepo/node_modules/react-apollo/lib/server.js:37:13) at walkTree (/Users/Max/Development/testrepo/node_modules/react-apollo/lib/server.js:37:13) at getQueriesFromTree (/Users/Max/Development/testrepo/node_modules/react-apollo/lib/server.js:58:5) at getDataFromTree (/Users/Max/Development/testrepo/node_modules/react-apollo/lib/server.js:73:19)

example

Most helpful comment

Any ideas on this?

on getInitialProps of my route I am deciding in which language the page will be displayed and I want to fill <html> lang attribute with proper value. The value is being stored in the Redux store

All 8 comments

_document is only rendered server side. It's meant to be used to change the document structure. It's not meant to load data there 馃槃

The issue does not even imply loading data from the _document.js.

The problem lies with Aphrodite SSR stylesheet injection not cooperating with HOC wrapper

1751 is related

Okay, re-opening 馃憣

Any ideas on this?

on getInitialProps of my route I am deciding in which language the page will be displayed and I want to fill <html> lang attribute with proper value. The value is being stored in the Redux store

@dzek69 there is currently no way to do that.

@makstr could you provide an example so we can test this?

Since v3.0.1 we provide a way to wrap the App component https://github.com/zeit/next.js/pull/2010

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olifante picture olifante  路  3Comments

wagerfield picture wagerfield  路  3Comments

flybayer picture flybayer  路  3Comments

jesselee34 picture jesselee34  路  3Comments

timneutkens picture timneutkens  路  3Comments