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

feat(typescript-react-apollo): Add options support to useFragment

Open rohit-gohri opened this issue 1 year ago • 3 comments

Description

Updates useFragment generate hooks to include options and fix name of fragment doc to handle PascalCase conversion.

Related #711

Type of change

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

Screenshots/Sandbox (if appropriate/relevant):

Adding links to sandbox or providing screenshots can help us understand more about this PR and take action on it as appropriate

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

  • [x] tested locally in my own project
  • [x] updated existing useFragment test, updated a dev-test file, ran yarn build, yarn generate:examples, yarn test and all completed successfully

Test Environment:

  • OS: Mac
  • @graphql-codegen/cli: "^5.0.2",
  • @graphql-codegen/typescript-react-apollo: 4.3.0
  • NodeJS: v20.11.0

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
  • [ ] 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
  • [ ] Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

rohit-gohri avatar Jun 09 '24 00:06 rohit-gohri

🦋 Changeset detected

Latest commit: 3a93a85087618698040639771e95c35c1d46c058

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/typescript-react-apollo Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 09 '24 00:06 changeset-bot[bot]

Hey @saihaj , tagging you since you approved/published the original support for useFragment in https://github.com/dotansimha/graphql-code-generator-community/pull/483#issuecomment-1924247079

Would be nice if you can check this out, or let me know if I can ask someone else for a review.

rohit-gohri avatar Jul 15 '24 11:07 rohit-gohri

Are there any updates on this? Is nice to have generated hooks for fragments, but due to how currently additional options cannot be passed the withFragmentHooks: true option is pretty much unusable.

SimpleCreations avatar Jun 13 '25 09:06 SimpleCreations