Skip to content
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

Closed
wants to merge 6 commits into from
Closed

Spike out glamor hoc for ssr #10

wants to merge 6 commits into from

Conversation

johno
Copy link
Member

@johno johno commented Oct 19, 2017

No description provided.

@@ -104,6 +111,10 @@ const createStatic = async (filename, options) => {
}

module.exports = (filename, options = {}, cb) => {
const pkg = readPkgUp.sync().pkg
Copy link
Member

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?

}
}

WithCss.getInitialProps = ({ Component, props }) => {
Copy link
Member

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...

Copy link
Member Author

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?

Copy link
Member Author

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.

let newProps = {}

if (Component.getInitialProps) {
newProps = await Component.getInitialProps({ Component, props })
Copy link
Member Author

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.

@johno
Copy link
Member Author

johno commented Dec 15, 2017

This functionality was added in a diff PR.

@johno johno closed this Dec 15, 2017
@johno johno deleted the glamor-ssr branch December 15, 2017 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants