apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.37k stars 2.66k forks source link

valueChanges does not trigger anymore after fetching the same object type from another, separate query #11995

Open fdruga opened 2 months ago

fdruga commented 2 months ago

Issue Description

Hi,

We have a problem currently in our project - valueChanges does not trigger anymore when we fetch the same object type in another query.

The first query is as follows:

query GetBreadInfo {
  bread {
    uid
    name
  }
}

After some time we make another query on another object, but in the subfields we can also get the Bread, like this:

query GetRestaurantInfo {
  restaurant {
    uid
    name
    food {
        uid
        name
    }
  }
}

In the "food" subquery we receive objects of type Bread.

At this step we want to fetch the rest of the bread (initially we only took 5) and we try a manual fetchMore() on the initial queryRef. When fetching again on the first query, the valueChanges does not trigger anymore without reinitializing the whole subscription.

Thank you for any kind of suggestion or advice about this!

Link to Reproduction

no reproduction :(

Reproduction Steps

Steps included in main message.

@apollo/client version

3.9.11

alessbell commented 2 months ago

Hi @fdruga 👋

valueChanges does not trigger anymore

At which version(s) do you observe this change? Thanks for including the version of Apollo Client in your issue, but it looks like you're using apollo-angular and both valueChanges and queryRef are Apollo Angular APIs. If you have more info that points to a particular Apollo Client version that broke expected behavior, I'd be happy to look into it more. Thanks!

fdruga commented 2 months ago

The behavior is reproducing in all versions, starting from 3.7 to 3.11 We have a pretty antic version of apollo-angular in our app, 2.6.0.

Right now I'm trying to isolate the problem in an empty project in order to test out if upgrading apollo-angular solves the issue.

Thank you a lot for the fast response and the information!