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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stitch) fix abstract type merge failure #1981

Merged
merged 2 commits into from Sep 1, 2020

Conversation

gmac
Copy link
Contributor

@gmac gmac commented Sep 1, 2020

Fixes the bug discussed in: #1973. This appears to be a regression that appeared in a recent version. This applies the fix mentioned by @yaacovCR, and adds supporting tests.

    ReferenceError: Cannot access 'typeMap' before initialization

      208 |   const typeMap = configs.reduce((acc, config) => {
      209 |     config.types.forEach(type => {
    > 210 |       typeMap[type.name] = type;
          |       ^
      211 |     });
      212 |     return acc;
      213 |   }, Object.create(null));

      at packages/stitch/src/mergeCandidates.ts:210:7
          at Array.forEach (<anonymous>)
      at packages/stitch/src/mergeCandidates.ts:209:18
          at Array.reduce (<anonymous>)
      at mergeUnionTypeCandidates (packages/stitch/src/mergeCandidates.ts:208:27)
      at Object.mergeCandidates (packages/stitch/src/mergeCandidates.ts:45:12)
      at packages/stitch/src/typeCandidates.ts:212:27
          at Array.forEach (<anonymous>)
      at Object.buildTypeMap (packages/stitch/src/typeCandidates.ts:202:31)
      at Object.stitchSchemas (packages/stitch/src/stitchSchemas.ts:121:19)

TODO:

  • If this PR is a new feature, reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@gmac gmac changed the title still fails for me? Abstract type merge failure Sep 1, 2020
@gmac gmac changed the title Abstract type merge failure Fix abstract type merge failure Sep 1, 2020
@gmac gmac changed the title Fix abstract type merge failure fix(stitch) fix abstract type merge failure Sep 1, 2020
@yaacovCR
Copy link
Collaborator

yaacovCR commented Sep 1, 2020

Looks like regression introduces in #1917 and releases in v6.1.0. Thanks for catching this!

@yaacovCR yaacovCR merged commit 3f01f85 into ardatan:master Sep 1, 2020
@yaacovCR yaacovCR added the bugfix label Sep 1, 2020
@theguild-bot
Copy link
Collaborator

The latest changes of this PR are available as alpha in npm: 6.2.1-alpha-3f01f855.0

Quickly update your package.json by running:

npx match-version @graphql-tools 6.2.1-alpha-3f01f855.0

@gmac gmac deleted the gm-failing-abstract-type branch January 8, 2021 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants