-
-
Notifications
You must be signed in to change notification settings - Fork 8
react-spaceman and serverside rendering #4
Comments
It would be very cool to support SSR. If you have any ideas how to do it feel free to send a PR! I guess just checking for |
How about removing |
We’re not using JSS. https://github.com/sapegin/react-spaceman/blob/master/src/styles.ts |
Ah, right I only saw it in the But my proposal is still valid: Don't try to deduplicate css by collecting it and using class names, but instead write either inline styles via the Also: Collecting styles/classes in a module-scoped variable could potentially leak during SSR when the consumer is doing async rendering and multiple request are being handled in the same time, right? |
This is something I’m not going to do.
I don’t understand what problems you see here. |
I guess we should extract this code and make CSS available as a string. @Wormyy would that be enough? Lines 15 to 46 in 5988e85
|
Assuming you do streaming SSR or use react@16s new async rendering and two requests arrive at almost the same time, the first request starts rendering and therefore fills the module-scoped variable with class names that it has collected during rendering. |
Hi again!
Since
attachStyles
relies ondocument
being defined, I just realized it's currently impossible for us to use it with our CSS modules + SSR setup.That's a major bummer because we really like it :)
We are considering making a PR but since our setup is a bit specific, maybe we would need to fork, which I would really like to avoid.
Do you have any suggestions how to approach this?
Thanks a lot a for answering these questions!
The text was updated successfully, but these errors were encountered: