-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emotion 10 & SSR rendering #819
Comments
Could you provide a reproduction or at least more details about your setup? |
Actually, I think the issue is with my server side setup, particularly in call: import { ApolloProvider, getDataFromTree } from 'react-apollo';
...
await getDataFromTree(markup) removing |
Could you show all of the code that has the getDataFromTree call, the renderToString call and where you create the element to pass to those functions? |
I've got a reproduction of it, looking into it now. |
thanks @mitchellhamilton. Please let me know if you'd need anything. |
This happened because react-apollo's SSR broke the new createContext API, I just submitted a PR to react-apollo to fix it. I'm gonna close this since it isn't an issue with emotion. |
great, thanks! |
@mitchellhamilton I've been hitting the same issue, glad to see the patch! Quick note on the PR - it looks like you need to sign the meteor CLA before they'll merge it. https://contribute.meteor.com/ |
I’ve already signed it :) |
emotion
version: 10 (@emotion/core": "^0.13.0")react
version: 16.4.2Hi,
I'm trying to use emotion 10 (@emotion/core & @emotion/styled-base) for a project, it works great client-side, but not sure how to tackle server side rendering.
It's supposed to be working out of the box, but for me it doesn't and I'm not 100% why. I've tracked it down to @emotion/utils and
insertStyles
function that returns nothing and should be returningjoinedRules
. It appears that context is caching those rules globally on the server so checkcontext.inserted[insertable.name] === undefined
returnsfalse
, except for the first call. It could be something wrong with my project setup as well, can't exclude that.Anyways even if I set that condition to
true
and styles get rendered, all of them get rendered inline before component for every component. That get's really problematic when I have lists of components then styles are duplicated for each of them. Not sure if it's supposed to work that way or it's something with my server side code or that this condition can't be set to be true always.What I'd like to know is if 'out-of-the-box' server side rendering of emotion is supposed to insert duplicated styles definition to resulting html or not as it would be kind of deal breaker for me.
Thanks!
The text was updated successfully, but these errors were encountered: