question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Breaking change with @defer changes and apollo angular package

See original GitHub issue

Intended outcome: My angular project utilizing @graphql-codegen, apollo-angular, and @apollo/client should build properly

Actual outcome: Where the code attempts to perform a mutation and manipulate the result, there is a typescript error stating that “property ‘data’ does not exist on type ‘MutationResult<…’”.

This is because the MutationResult interface in the apollo-angular package extends the FetchResult type in @apollo/client. When making changes to the @apollo/client types to support @defer (specifically here), FetchResult was changed from an interface to a type, and more importantly, it is set equal to a union type.

The above will cause a “An interface can only extend an object type or intersection of object types with statically known members” error if the apollo-angular package uses apollo-client v3.7.0. That is what “removes” the data property from the mutation result object.

How to reproduce the issue: I don’t have a reproduction, but if you try to define your own MutationResult like the apollo-angular package does, I assume you’ll get the error. That, or go about it the long way and have a project with the packages I outlined above, create a mutation, and try to access the data property of the result.

This issue is also brought up in the apollo-angular project’s github repo: https://github.com/kamilkisiela/apollo-angular/issues/1818

Versions@apollo/client”: “3.7.0”, “apollo-angular”: “3.0.1”, “@graphql-codegen/cli”: “2.13.2”,

System: OS: Windows 10 10.0.19044 Binaries: Node: 16.13.2 - C:\Program Files\nodejs\node.EXE npm: 7.5.6 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1266.0), Chromium (106.0.1370.34)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:16
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
dylanwulfcommented, Oct 11, 2022

Hello, just a friendly reminder to please wrap @defer inside of backticks (``) to avoid accidentally tagging the github user named defer. Thanks!

1reaction
bignimbuscommented, Dec 6, 2022

@andrii-lundiak thanks for sharing 🙏🏻 Unfortunately I’m not able to determine much from this package.json. I recommend creating a runnable reproduction via a repo or codesandbox so we can determine expected vs. actual behavior in concrete terms. If anyone else in the thread is experiencing this issue I’d be eager to hear your experiences as well!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating to Apollo Client 3.0 - Apollo GraphQL Docs
Breaking Changes : useQuery no longer maintains the previously fetched results in its data result when loading new data. Instead, when new data...
Read more >
Migration Guide – Angular - GraphQL Code Generator
Updating your app to Angular Apollo v3. ... The lazy-loading was broken in the previous major version but now it's fixed, all thanks...
Read more >
@apollo/client | Yarn - Package Manager
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components...
Read more >
GraphQL Code Libraries, Tools and Services
Compare schemas, validate documents, find breaking changes, find similar types, ... Once the code is generated, you can decide to manually edit it...
Read more >
Changelog | Meteor API Docs
Change the tar implementation for streams, used on deploying and unpacking packages. Reduced "upload bundle" time when deploying is expected. Breaking Changes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found