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

fix(apollo-react): adds deep merging for `defaultOptions`

Open rushelex opened this issue 2 years ago • 7 comments

Description

This PR adds the ability to deep merge passed options using mergeDeep, which is passed in the configuration and when calling the operation.

Required dependencies list:

  • deepmerge – as the most popular package for deep merging of objects and arrays

Related:

  • #399

This PR can also help solve these issues:

  • #130
  • #220

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I ran the yarn test command in the root of the graphql-code-generator-comminuty project to check that the functionality is not broken and everything works as expected.

  • [x] Tests in packages/plugins/typescript/react-apollo/tests/react-apollo.spec.ts

Test Environment:

  • OS: MacOS
  • @graphql-codegen/typescript-react-apollo: 4.0.0
  • NodeJS: 18.16.1

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
  • [ ] 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
  • [ ] 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

rushelex avatar Sep 13 '23 08:09 rushelex

⚠️ No Changeset found

Latest commit: 64d907c466dc220d8202c1ce89e956c49e3dc2bc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Sep 13 '23 08:09 changeset-bot[bot]

@dotansimha, please look at this PR

rushelex avatar Sep 18 '23 08:09 rushelex

hey @rushelex can you sync this branch with main and that maybe fixes CI issues

saihaj avatar Sep 25 '23 15:09 saihaj

Wouldn't this change introduce a breaking change? I mean, all users of apollo-react would have to install deepmerge as their runtime dependency, otherwise something might break, right?

HermanBilous avatar Sep 25 '23 16:09 HermanBilous

can you sync this branch with main and that maybe fixes CI issues

@saihaj yes, I'll sync changes

rushelex avatar Oct 19 '23 13:10 rushelex

Wouldn't this change introduce a breaking change? I mean, all users of apollo-react would have to install deepmerge as their runtime dependency, otherwise something might break, right?

@HermanBilous no, users of apollo-react will not have to install an additional dependency because this dependency is already installed in this package in dependencies

rushelex avatar Oct 19 '23 13:10 rushelex

@saihaj, @HermanBilous, check again, please

rushelex avatar Nov 08 '23 10:11 rushelex