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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰: Mutations with @defer only responds with the first part #10272

Closed
lleadbet opened this issue Nov 9, 2022 · 7 comments 路 Fixed by #10368
Closed

馃悰: Mutations with @defer only responds with the first part #10272

lleadbet opened this issue Nov 9, 2022 · 7 comments 路 Fixed by #10368
Assignees
Labels
馃攳 investigate Investigate further

Comments

@lleadbet
Copy link
Contributor

lleadbet commented Nov 9, 2022

To clarify, this is happening from a non-federated AS4 instance, not router.

Intended outcome:
Using the useMutation hook with a mutation with @defer results in only the first chunk loading.

For example, given a server responding with:


---
content-type: application/json; charset=utf-8

{"hasNext":true,"data":{"makePayment":{"id":"1afa84cc-26a5-4820-a496-33c8366e03cd","__typename":"MakePaymentResult"}}}
---
content-type: application/json; charset=utf-8

{"hasNext":false,"incremental":[{"path":["makePayment"],"data":{"paymentStatus":{"__typename":"PaymentSuccess","id":"2a3a1ddd-81e1-4535-8a9c-e8dc1ce38026","billedAmount":39.854330085558395},"__typename":"MakePaymentResult"}}]}
-----

Only

{"makePayment":{"id":"1afa84cc-26a5-4820-a496-33c8366e03cd","__typename":"MakePaymentResult"}

is reported in the data object.

Actual outcome:
Mutations update with the correct data, same as with useQuery which works as expected.

How to reproduce the issue:
Example Repo: https://github.com/lleadbet/graphql-galaxy-demo

Versions

  System:
    OS: macOS 12.6
  Binaries:
    Node: 16.16.0 - ~/.volta/tools/image/node/16.16.0/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 8.11.0 - ~/.volta/tools/image/node/16.16.0/bin/npm
  Browsers:
    Chrome: 107.0.5304.110
    Firefox: 106.0.5
    Safari: 16.0
  npmPackages:
    @apollo/client: ^3.7.1 => 3.7.1 
@bignimbus bignimbus added the 馃攳 investigate Investigate further label Nov 9, 2022
@alessbell alessbell added this to the Release 3.8 milestone Nov 9, 2022
@alessbell
Copy link
Member

This will require some changes to QueryManager most likely, inside of the markMutationResult method.

@alessbell alessbell self-assigned this Nov 9, 2022
@jpvajda
Copy link
Contributor

jpvajda commented Nov 14, 2022

@alessbell just to confirm, is there any change Apollo Router has to consider here or is this strictly on the client side? cc @abernix

@alessbell
Copy link
Member

@jpvajda I don't have a test case that works against the router yet, but I'm not sure if the issue is in my local subgraph. @abernix, is there a mutation example you can share? If not I will go ahead and open a bug.

@lleadbet
Copy link
Contributor Author

To clarify, this is happening from a non-federated AS4 instance, not router

@alessbell
Copy link
Member

Yep - I was referring to my attempt to reproduce the issue using the router. When I use a subgraph with the same schema used in https://github.com/lleadbet/graphql-galaxy-demo, I get a "cannot query field 'makePayment' on type 'Query'" error from the router.

@jpvajda
Copy link
Contributor

jpvajda commented Nov 14, 2022

@lleadbet That's good info, thanks for clarifying that.

@alessbell
Copy link
Member

Opened the router issue here: apollographql/router#2099

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

Successfully merging a pull request may close this issue.

4 participants