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

Explorer overriding results #387

Open
mdugue opened this issue Dec 3, 2021 · 3 comments
Open

Explorer overriding results #387

mdugue opened this issue Dec 3, 2021 · 3 comments
Labels
Bug Something isn't working

Comments

@mdugue
Copy link

mdugue commented Dec 3, 2021

Hi,

First of all: 1. I'm not sure if this is ideed a bug but it looks pretty much like this to me. 2. I'm more than grateful for this great tooling and the work being done on it!

I just stumbled on a problem, which I think can be boiled down to this: When I send 2 queries to the same top-level schema-Query field with different selections – but same variables or none –, only one of them will be visible in the DevTools Explorer. For example, sending those 2 queries:

const FIRST_MAXCP_QUERY = gql`
query Pokemon {
  __typename
  pokemon(id: "001") {
    id
    maxCP
  }
}
`

and

const FIRST_NAME_QUERY = gql`
query Pokemon {
  __typename
  pokemon(id: "001") {
    __typename
    id
    name
  }
}

leads to either name or maxCP beeing shown in the Devtools Explorer (apparently the first response coming in)

image

Why is this happening, shouldn't the results be either merged or shown as 2 different entries? Is this related to the devtools at all or rather to internal caching? (Btw: I couldn't see any difference between standard document cache and graphcache)

reproducible via https://codesandbox.io/s/urql-devtools-overriding-results-kqr91

Thanks a lot in advance!!

@mdugue mdugue added the Bug Something isn't working label Dec 3, 2021
@mdugue
Copy link
Author

mdugue commented Dec 3, 2021

interestingly the behavior is different when quering arrays, here the results seem to get merged.
Eg, sending those two queries

const POKEMONS_NAME_QUERY = gql`
  query Pokemons {
    pokemons(limit: 10) {
      id
      name
    }
  }
`;

const POKEMONS_MAXCP_QUERY = gql`
  query Pokemons {
    __typename
    pokemons(limit: 10) {
      id
      maxCP
    }
  }
`;

leads to a merged preview:
image

@uloco
Copy link

uloco commented Aug 10, 2023

I experience the same behaviour. We are using very few endpoints throughout the app with lots and lots of different queries on them. I thought the explorer view as a tool to see the merged state (since we are using graphcache).

@Undistraction
Copy link

Seeing this too, even when supplying a schema. Making multiple queries on an Enrolment type, each requesting a different set of fields. Each query overwrites the previous one, and I would expect the fields to accumulate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants