Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

getDataFromTree queryErrors just references itself #1812

Closed
brandonmp opened this issue Mar 20, 2018 · 7 comments
Closed

getDataFromTree queryErrors just references itself #1812

brandonmp opened this issue Mar 20, 2018 · 7 comments
Assignees

Comments

@brandonmp
Copy link

Intended outcome:
When using getDataFromTree(), query errors should be individually accessible

Actual outcome:
When a query throws >1 errors, the error messages are swallowed and the resultant error object just circularly references itself, i.e., error.queryErrors === error

{ Error: 2 errors were thrown when executing your GraphQL queries.
    at /mnt/c/Users/brand/code/admitbrain/node_modules/react-apollo/graphql.js:4:1
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7) queryErrors: [ [Circular] ] }

Version

3 tasks
@anand-sundaram-zocdoc
Copy link
Contributor

This actually happens specifically in the situation when a wrapped component that makes a GraqphQL query contains at least 2 other wrapped components that make GraqphQL queries further down the tree that both throw errors. This might be useful to know if you're trying to work around the issue.

@anand-sundaram-zocdoc
Copy link
Contributor

I think this is fixed in #1978

@anand-sundaram-zocdoc
Copy link
Contributor

After testing locally, it's not completely fixed in #1978. There's one instance of this which no longer occurs in 2.1.6, but the issue can still happen. 😞

@hwillson
Copy link
Member

Would someone here be able to put together a small runnable reproduction that shows this happening? Thanks!

@anand-sundaram-zocdoc
Copy link
Contributor

@hwillson did you see the new unit test? If you run that unit test on master the last 2 assertions are not satisfied. But if you want I can certainly convert that unit test into an example. (Is there any example repro for another issue I should try to emulate?)

@hwillson
Copy link
Member

@anand-sundaram-zocdoc Sorry, I missed the PR link completely (not enough ☕️ yet). No need to worry about the repro - I'll review the PR shortly. Thanks!

@hwillson
Copy link
Member

#2133 was merged, so this should be resolved in the next react-apollo release. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants