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

Running restore(initialState || {}) on InMemoryCache() gives Circular structure in "getInitialProps" error #83

Open
NinjaOnRails opened this issue Sep 19, 2019 · 1 comment

Comments

@NinjaOnRails
Copy link

NinjaOnRails commented Sep 19, 2019

Setting cache: new InMemoryCache().restore(initialState || {}) results in Error: Circular structure in "getInitialProps" result of page "/". https://err.sh/zeit/next.js/circular-structure
So I had to remove it from my withApollo setup. What does it do anyway? I've been googling and saw other people run into this with no solution. I'll close this issue if it's not relevant.

@shrugs
Copy link

shrugs commented Sep 29, 2019

one of the objects in the result of https://github.com/lfades/next-with-apollo/blob/master/src/withApollo.tsx#L95 has circular references (almost definitely the apollo client?) (not the apollo client, since the serialization is stubbed out here which will ignore server->client serialization) which next will complain about, since that return object has to be serialized, and circular references are not kosher in JSON serialization.

not sure why removing the .restore() line would stop that error, though, since that object would be serialized and sent over regardless?

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

No branches or pull requests

2 participants