๐ Thanks for apollo, it's pretty cool
Intended outcome:
Data fetches without error
Actual outcome:
Call Stack Exceeded Error

I did some digging into this error, and here is what I found:
isDifferentFromLastResult is called here:
https://github.com/apollographql/apollo-client/blob/master/packages/apollo-client/src/core/QueryManager.ts#L697
isEqual is called here:
https://github.com/apollographql/apollo-client/blob/master/packages/apollo-client/src/core/ObservableQuery.ts#L275
The two objects that are passed to isEqual look like this:

a looks like:

b looks like:

When you invoke the getters on b it looks like a. Both b and a are infinitely nested:
a.allLinks[0].category.links[0] is the same object as a.allLinks[0]
b.allLinks[0].category.links[0] is the same object as b.allLinks[0]
The way isEqual is written, it does not support infinitely nested objects. This leads to the maximum call stack error because isEqual keeps calling itself with properties deeper and deeper into the infinitely nested tree.
Why is isEqual passed an infinitely nested tree? Is isEqual supposed to support infinitely nested trees?
How to reproduce the issue:
I'm not going to create a minimal reproduction quite yet, first I wanted to check and see if you had any insight based on the debugging above โ๏ธ
Versions
System:
OS: macOS 10.14.2
Binaries:
Node: 10.11.0 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Browsers:
Chrome: 74.0.3729.131
Firefox: 65.0
Safari: 12.0.2
We are using @nuxtjs/[email protected] and [email protected], although I don't think the error comes from the nuxt integration. We also are using [email protected]
Any help or further guidance in debugging would be appreciated ๐
Verified this issue is still present in [email protected]. Replacing the apollo implementation of isEqual with lodash isEqual fixes the error. Infinitely nested trees should definitely be supported.
This should (soon) be fixed by https://github.com/apollographql/apollo-client/pull/4915.
This should now be fixed if you update to [email protected], thanks to @capaj's PR #4915.
Awesome, thanks @benjamn , @capaj !
Most helpful comment
This should now be fixed if you update to
[email protected], thanks to @capaj's PR #4915.