gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.26k stars 10.32k forks source link

Use of @link directive, return `null` without error #23943

Closed jorisre closed 4 years ago

jorisre commented 4 years ago

Description

I'm using @link directive to link data between entities. It works expect for one case which does not throw error.

Steps to reproduce

Reproduction repo : https://github.com/joris-/gatsby-issue

Just clone the repo ⬆️, yarn develop, open graphqli and exec these queries :

Two subqueries with similar data structure :

query MyQuery {
  allPokemon(limit: 2) {
    edges {
      node {
        name
        forms {
          name # works
        }
      }
    }
  }
  allRegion(limit: 1) {
    edges {
      node {
        name
        version_groups {
          name # doesn't works
        }
      }
    }
  }
}

Expected result

version_groups should return data like :

Expected result ``` { ..., "version_groups": [ { "generation": { "name": "generation-i", "url": "https://pokeapi.co/api/v2/generation/1/" }, "id": 1, "move_learn_methods": [ { "name": "level-up", "url": "https://pokeapi.co/api/v2/move-learn-method/1/" }, { "name": "machine", "url": "https://pokeapi.co/api/v2/move-learn-method/4/" }, { "name": "stadium-surfing-pikachu", "url": "https://pokeapi.co/api/v2/move-learn-method/5/" } ], "name": "red-blue", "order": 1, "pokedexes": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/pokedex/2/" } ], "regions": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/region/1/" } ], "versions": [ { "name": "red", "url": "https://pokeapi.co/api/v2/version/1/" }, { "name": "blue", "url": "https://pokeapi.co/api/v2/version/2/" } ] }, { "generation": { "name": "generation-i", "url": "https://pokeapi.co/api/v2/generation/1/" }, "id": 2, "move_learn_methods": [ { "name": "level-up", "url": "https://pokeapi.co/api/v2/move-learn-method/1/" }, { "name": "machine", "url": "https://pokeapi.co/api/v2/move-learn-method/4/" }, { "name": "stadium-surfing-pikachu", "url": "https://pokeapi.co/api/v2/move-learn-method/5/" } ], "name": "yellow", "order": 2, "pokedexes": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/pokedex/2/" } ], "regions": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/region/1/" } ], "versions": [ { "name": "yellow", "url": "https://pokeapi.co/api/v2/version/3/" } ] }, { "generation": { "name": "generation-ii", "url": "https://pokeapi.co/api/v2/generation/2/" }, "id": 3, "move_learn_methods": [ { "name": "level-up", "url": "https://pokeapi.co/api/v2/move-learn-method/1/" }, { "name": "egg", "url": "https://pokeapi.co/api/v2/move-learn-method/2/" }, { "name": "machine", "url": "https://pokeapi.co/api/v2/move-learn-method/4/" } ], "name": "gold-silver", "order": 3, "pokedexes": [ { "name": "original-johto", "url": "https://pokeapi.co/api/v2/pokedex/3/" } ], "regions": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/region/1/" }, { "name": "johto", "url": "https://pokeapi.co/api/v2/region/2/" } ], "versions": [ { "name": "gold", "url": "https://pokeapi.co/api/v2/version/4/" }, { "name": "silver", "url": "https://pokeapi.co/api/v2/version/5/" } ] }, { "generation": { "name": "generation-ii", "url": "https://pokeapi.co/api/v2/generation/2/" }, "id": 4, "move_learn_methods": [ { "name": "level-up", "url": "https://pokeapi.co/api/v2/move-learn-method/1/" }, { "name": "egg", "url": "https://pokeapi.co/api/v2/move-learn-method/2/" }, { "name": "tutor", "url": "https://pokeapi.co/api/v2/move-learn-method/3/" }, { "name": "machine", "url": "https://pokeapi.co/api/v2/move-learn-method/4/" } ], "name": "crystal", "order": 4, "pokedexes": [ { "name": "original-johto", "url": "https://pokeapi.co/api/v2/pokedex/3/" } ], "regions": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/region/1/" }, { "name": "johto", "url": "https://pokeapi.co/api/v2/region/2/" } ], "versions": [ { "name": "crystal", "url": "https://pokeapi.co/api/v2/version/6/" } ] }, { "generation": { "name": "generation-iii", "url": "https://pokeapi.co/api/v2/generation/3/" }, "id": 7, "move_learn_methods": [ { "name": "level-up", "url": "https://pokeapi.co/api/v2/move-learn-method/1/" }, { "name": "egg", "url": "https://pokeapi.co/api/v2/move-learn-method/2/" }, { "name": "tutor", "url": "https://pokeapi.co/api/v2/move-learn-method/3/" }, { "name": "machine", "url": "https://pokeapi.co/api/v2/move-learn-method/4/" } ], "name": "firered-leafgreen", "order": 9, "pokedexes": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/pokedex/2/" } ], "regions": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/region/1/" } ], "versions": [ { "name": "firered", "url": "https://pokeapi.co/api/v2/version/10/" }, { "name": "leafgreen", "url": "https://pokeapi.co/api/v2/version/11/" } ] }, { "generation": { "name": "generation-iv", "url": "https://pokeapi.co/api/v2/generation/4/" }, "id": 10, "move_learn_methods": [ { "name": "level-up", "url": "https://pokeapi.co/api/v2/move-learn-method/1/" }, { "name": "egg", "url": "https://pokeapi.co/api/v2/move-learn-method/2/" }, { "name": "tutor", "url": "https://pokeapi.co/api/v2/move-learn-method/3/" }, { "name": "machine", "url": "https://pokeapi.co/api/v2/move-learn-method/4/" }, { "name": "light-ball-egg", "url": "https://pokeapi.co/api/v2/move-learn-method/6/" }, { "name": "form-change", "url": "https://pokeapi.co/api/v2/move-learn-method/10/" } ], "name": "heartgold-soulsilver", "order": 12, "pokedexes": [ { "name": "updated-johto", "url": "https://pokeapi.co/api/v2/pokedex/7/" } ], "regions": [ { "name": "kanto", "url": "https://pokeapi.co/api/v2/region/1/" }, { "name": "johto", "url": "https://pokeapi.co/api/v2/region/2/" } ], "versions": [ { "name": "heartgold", "url": "https://pokeapi.co/api/v2/version/15/" }, { "name": "soulsilver", "url": "https://pokeapi.co/api/v2/version/16/" } ] } ] } ```

Actual result

@link seems not work, and return null :

{
    ...,
    "version_groups": null
}

gatsby issue screenshot

Environment

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.1 - /usr/local/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.138
    Firefox: 75.0
    Safari: 13.1
  npmPackages:
    gatsby: ^2.21.21 => 2.21.21 
    gatsby-image: ^2.4.3 => 2.4.3 
    gatsby-plugin-manifest: ^2.4.2 => 2.4.2 
    gatsby-plugin-offline: ^3.2.1 => 3.2.1 
    gatsby-plugin-react-helmet: ^3.3.1 => 3.3.1 
    gatsby-plugin-sharp: ^2.6.2 => 2.6.2 
    gatsby-source-filesystem: ^2.3.1 => 2.3.1 
    gatsby-transformer-sharp: ^2.5.2 => 2.5.2 
  npmGlobalPackages:
    gatsby-cli: 2.12.7
github-actions[bot] commented 4 years ago

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

BenJenkinson commented 4 years ago

I'm having similar trouble with the @link directive as well. (Not stale please!)

github-actions[bot] commented 4 years ago

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] commented 4 years ago

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜