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

Add apollo example with next.js #733

Closed
wants to merge 6 commits into from

Conversation

donedgardo
Copy link

No description provided.

@donedgardo
Copy link
Author

#387

@rauchg
Copy link
Member

rauchg commented Jan 11, 2017

Not a big fan of submodules. Would it make sense to check it in statically?

@rauchg
Copy link
Member

rauchg commented Jan 11, 2017

Thanks for the contribution!

@donedgardo
Copy link
Author

Will do

@donedgardo
Copy link
Author

donedgardo commented Jan 11, 2017

@rauchg Should be done.
Thank you for the great work!
We'll be writing a medium article about your amazing work soon.

Btw travis ci build failed because no node env was set?

@rauchg
Copy link
Member

rauchg commented Jan 11, 2017

Oh, seems like linting issues. Please run the linter on the new directory.

@rauchg
Copy link
Member

rauchg commented Jan 11, 2017

@arunoda
Copy link
Contributor

arunoda commented Jan 11, 2017

Run " npm run lint " in the main next.js directory rather in the example directory.

@adamsoffer
Copy link
Contributor

adamsoffer commented Jan 11, 2017

Thanks @donedgardo - let's hold off on this? @sedubois and I have been hardening a simplified react apollo example over at https://github.com/ads1018/next-apollo-example

@donedgardo
Copy link
Author

Fixed linting issues.

@rauchg
Copy link
Member

rauchg commented Jan 11, 2017

I'd like to have a more minimalistic example, something that only does the apollo data wrapping (minus all the stylesheets, external fonts, etc). Maybe @ads1018 can contribute some ideas on how to make the most to-the-point Apollo example here?

@donedgardo
Copy link
Author

I could simplify it with only rendering one component connected to apollo.

@adamsoffer
Copy link
Contributor

adamsoffer commented Jan 12, 2017

@rauchg definitely. A lot of our thoughts have been captured towards the end of the apollo example issue. I'll follow up with a summary of the minimalistic approach we took in our example.

@adamsoffer
Copy link
Contributor

adamsoffer commented Jan 17, 2017

@donedgardo @rauchg I ended up creating a separate pull request since I took a different approach. In my example, I simply wrap the page inside a higher-order component I created called withData. Using the HOC pattern I'm able to pass down a central store of query result data created by Apollo into the React component hierarchy defined inside the page it wraps.

On initial page load, while on the server and inside the HOC getInitialProps, I invoke the Apollo method, getDataFromTree. This method returns a promise; at the point in which the promise resolves, the Apollo Client store is completely initialized.

@timneutkens
Copy link
Member

@donedgardo @ads1018 Thank you both so much for you contribution. This is pretty awesome. I think we should close one and work together on the best solution. From the looks of it #780 is more minimalistic. What do you guys think?

@sedubois
Copy link
Contributor

The other example has been merged so I think this can be closed 👍

@timneutkens
Copy link
Member

Done 👍🏻

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants