GQL.fetch() causes TypeError: Cannot assign to read only property 'data' of object #5288
-
I don't know if I'm encountering a bug or if I'm doing something wrong (I'm new to GraphQL, Apollo and this code generator). The code generation seems to work fine, but I am getting the following error when the app tries to execute a query. I tried both with fetch() and watch().valueChanges; they both give this same error: In Chrome's developer tools I can see that the query in fact is working: the server is returning the data. The query is very simple:
I launch the query from an NgRx effect:
In the AppModule I don't do anything special, I just have added this provider:
I'm using this library in a project with Nx, Angular, NgRx and apollo-angular. Your help is much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Might help to know: bypassing the cache avoids the error and allows to retrieve the data correctly.
|
Beta Was this translation helpful? Give feedback.
-
I have the same problem when I write the fetch code myself, so the problem is not related to the graphql-code-generator but probably with the Apollo Client. I'll continue this discussion on their github. |
Beta Was this translation helpful? Give feedback.
-
As you noticed, it's not related directory to codegen. You are using Apollo-Angular, right? please make sure to update to latest version of it, and if it's still not working, please report an issue there. Thanks! |
Beta Was this translation helpful? Give feedback.
As you noticed, it's not related directory to codegen. You are using Apollo-Angular, right? please make sure to update to latest version of it, and if it's still not working, please report an issue there. Thanks!