federation icon indicating copy to clipboard operation
federation copied to clipboard

WIP: Fix `@interfaceObject` + `__typename` / key bug

Open trevor-scheer opened this issue 2 years ago • 4 comments
trafficstars

Just a repro for now. As it stands currently, the query plan in the snapshot is correct but the test fails. The entire ... on T1 is unexpectedly missing.

trevor-scheer avatar Sep 25 '23 23:09 trevor-scheer

⚠️ No Changeset found

Latest commit: dc3f8fe068816fe81620eb68c86c6faac9c48b27

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 25 '23 23:09 changeset-bot[bot]

Deploy Preview for apollo-federation-docs canceled.

Name Link
Latest commit dc3f8fe068816fe81620eb68c86c6faac9c48b27
Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/651218acca4c4600082a954c

netlify[bot] avatar Sep 25 '23 23:09 netlify[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Sep 25 '23 23:09 codesandbox-ci[bot]

Just wanted to add a confirmed workaround for this problem. Any field on the interface could be defined at the root of that interface and not duplicated in the fragments.

From the test in this repo:

query {
    itfObj {
      __typename
      ... on T1 {
        __typename
        id
      }
      ... on T2 {
        # Uncomment id to break operation
        # id
        __typename
      }
    }
  }

Could be this to fix it and generate the appropriate plan:

query {
    itfObj {
        id
      __typename
      ... on T1 {
        __typename
      }
      ... on T2 {
        __typename
      }
    }
  }

michael-watson avatar Oct 04 '23 17:10 michael-watson