Lighthouse: Possible bug with query system

Created on 22 May 2018  路  9Comments  路  Source: nuwave/lighthouse

So I'm running into an issue where if you try to use graphql aliases you end up with the second field's values every time no matter what. Is this expected behavior? I also can't tell if this is an issue with lighthouse or with webonyx/graphql-php

here's an example query


{
  viewer {
    libraries(first: 10) {
      edges {
        node {
          id
          first: orders(first: 1) {
            edges {
              node {
                id
              }
            }
          }
          second: orders(first: 2) {
            edges {
              node {
                id
              }
            }
          }
        }
      }
    }
  }
}
````

you'll end up with 2 orders from both (assuming that data exists), and they'll be the same.


maybe strange or not... but this does work on a root query like this: 
```graphql
{
  first: node(id: "SW50ZXJjaGFuZ2U6MzU=") {
    ...intr
  }
  second: node(id: "SW50ZXJjaGFuZ2U6MTk=") {
    ...intr
  }
}

fragment intr on Interchange {
  id
  fileName
}

that actually resolves correctly. Maybe that's to be expected though.

bug

All 9 comments

Only a guess, you asking for x queries and what you get its what you asked for.
My guess in this example only second query executed as you can combine the 2 in 1 to get what you asking for.

Try adding a query with a search parameter that will offer you different results, I love to know what happens then

@kikoseijo I've added a scoped parameter to one of my queries with basically a search field. When I set a breakpoint at the scope resolver it gives me the args from only the last query, but twice. It's very odd.. my guess is there's something (maybe the resolver) that's scoped in such a way that this situation was not expected to happen. If I get some time I'll dig into the source code a bit and see what I can find out.

@alexwhb I think params goes on its own place and they get merged at client level.
its probably at client, you going to have to define different field name, so makes it a full new query.

Hope it helps.

@kikoseijo good call. That'll be my temporary fix for sure. Thanks for the advice.

@alexwhb There indeed does seem to be an issue w/ the paginator when querying the same field while assigning different names. If I query a field that is not a relationship w/ different args it works as expected which leaves me to believe that it is an issue w/ this package rather than a graphql-php error. Off the top of my head I'm thinking it's related to the QueryFilter but I'll report back when I find out what the issue is.

@chrissm79 Thanks for your prompt response. No rush, but I'll definitely be interested if you can resolve this issue. If I get some free time I'll dig around too.

Hey @alexwhb I believe I found the issue and resolved it with the latest commit to master. Give it a try and let me know if that resolved the issue for you!

@chrissm79 You're the best! I'll give it a go and let you know.

@chrissm79 just tested your latest commit. Works like a dream! Thank you so much. :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vine1993 picture vine1993  路  3Comments

mikeerickson picture mikeerickson  路  3Comments

spawnia picture spawnia  路  4Comments

a-ssassi-n picture a-ssassi-n  路  3Comments

spawnia picture spawnia  路  3Comments