-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Error in with-apollo example #3234
Comments
replace serverstate in Withdata.js with this line: let serverState = { apollo: {} }; this solves the issue :) |
Thank you very much! This solves the problem indeed :) Now I'll have to understand why on my project I see the data loaded by the client over the network, using the same initApollo and withData (I don't set any particular fetching policy, so it should default to cache as in the example) :S |
I discovered the problem for the client-side fetching, but I open a specific issue for that. |
@gcfabri I was getting this error because I was wrapping a component with |
@markbrouch I think it has something to do with |
@markbrouch @klujanrosas Did either of you figure out what the solution is for this? I'm trying to figure out how I can have the query built into the component itself so that it can be placed on any page. What does the |
Meeting a similar issue on Next 5 (yeah, I know, outdated version) For the record, I'm using https://github.com/adamsoffer/next-apollo-example which really simplifies the integration of apollo in nextjs |
Expected Behavior
The expected behavior is that of the online demo.
Current Behavior
Unfortunately, when you clone the repo, npm install and run it gives an error when you navigate client-side to the Home:
TypeError: Cannot read property 'data' of undefined at new WithData (http://localhost:3000/_next/1509705233244/page/:19478:79)
Steps to Reproduce (for bugs)
The steps of the example installation guide:
Context
I tried to clone the repo because I found the issue on my project after upgrading to React Apollo 2 and copying the /lib code of the example (initApollo and withData).
On my project I see another issue: I see always the client-side network call even on refresh. I fear that it has to do with some confusion with Apollo 2 InMemoryCache, sometimes found imported from apollo-cache-inmemory and sometimes from apollo-client-preset.
Thank you,
Matteo
The text was updated successfully, but these errors were encountered: