graphql-code-generator-community icon indicating copy to clipboard operation
graphql-code-generator-community copied to clipboard

[typescript-graphql-request] Allow passing Abortsignal to graphql-request

Open shkreios opened this issue 3 years ago • 11 comments

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Related #31

Type of change

  • [x] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • repository tests

Checklist:

  • [x] I have followed the CONTRIBUTING doc and the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules

shkreios avatar Dec 10 '22 13:12 shkreios

I moved this pr from the main repo, but have not yet tested the version of this code in any private repo. If you have some time @yemi you can test the code from this pr. Thank you.

shkreios avatar Dec 10 '22 13:12 shkreios

hey @ardatan @vadimdemedes sorry it took me longer than expected to get back to this. I wanted to avoid pushing anything that i did not at least test once inside an example repo. While following the getting started of new client preset of GraphQL codegen, I noticed that generating any library-specific code is not advised anymore and instead only TypedDocumentNode should be used.

TLDR: The codegen approach of this plugin is deprecated. Therefore, I don't know if it even makes sense to update it. Here is an example repo & stackblitz where I tested passing the Abortsignal to graphql-request from tanstack/query with the new graphql-codegen/client-preset

Will keep this pr open to wait for feedback

shkreios avatar Dec 26 '22 23:12 shkreios

Hey, I took another look at the options that graphql-options allows. As you can see, headers & signal are the only options allowed. If we want to pass any other options from RequestInit to it, we need to open a pr for graphql-request.

shkreios avatar Dec 28 '22 11:12 shkreios

Test repo with this pr repo & stackblitz

shkreios avatar Dec 28 '22 11:12 shkreios

any update on this?

mp205 avatar Jan 31 '23 02:01 mp205

any update on this?

@mp205 From my side, the pr is ready for review/merge. As mentioned in my comment here, I don't know how relevant it still is as graphql-codegen does advise against generating lib-specific code and instead to use TypedDocumentNodes.

And as mentioned in this comment , the proposed changes by @ardatan & @vadimdemedes are not possible as graphql-request only allows passing signal and headers to it instead of the Dom.RequestInit as a whole.

shkreios avatar Feb 03 '23 15:02 shkreios

Hello, Just would like to know will the PR be merged anytime soon. cc: @shkreios @ardatan

happyeric77 avatar Oct 04 '23 05:10 happyeric77

Hi, is there any updates regarding this MR? This feature would be crucial to my current project.

mxswat avatar Mar 20 '24 11:03 mxswat

@ardatan, @vadimdemedes Hi, can you help to let this be merged ?

tranhoanvo avatar Aug 20 '24 07:08 tranhoanvo

I am checking in here to see if we plan to merge this. @shkreios @ardatan

happyeric77 avatar Oct 04 '24 00:10 happyeric77