-
Notifications
You must be signed in to change notification settings - Fork 65
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
Spike out glamor hoc for ssr #10
Conversation
lib/static/index.js
Outdated
@@ -104,6 +111,10 @@ const createStatic = async (filename, options) => { | |||
} | |||
|
|||
module.exports = (filename, options = {}, cb) => { | |||
const pkg = readPkgUp.sync().pkg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been trying to handle the pkg parsing in the cli and trying to keep the lib
folder a little more functional – I think the cli already merges the pkg into options, doesn't it?
lib/static/ssr/glamor.js
Outdated
} | ||
} | ||
|
||
WithCss.getInitialProps = ({ Component, props }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not cancel out the user's getInitialProps
method? Might have to look at this again in the morning...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely does, I've been noodling on how to best "chain" them. I guess we could have a css ssr hoc that knows how to call the user's getInitialProps
and then tosses in __css
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed in Slack, we're going to explore an array style attr for getInitialProps
so that functions can be pluggable to inject props to the consuming component.
lib/static/ssr/glamor.js
Outdated
let newProps = {} | ||
|
||
if (Component.getInitialProps) { | ||
newProps = await Component.getInitialProps({ Component, props }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will undoubtedly need to be able to handle an array of getInitialProps
functions. I will spec out how that should work and spike it tomorrow.
This functionality was added in a diff PR. |
No description provided.