-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Mutations Nullify Intersecting Cache Objects #3468
Comments
Just want to +1 that I have run into this issue on the same: |
@bessey Could be, but I see a key difference in the fact that the issue I’m seeing occurs even when the query includes an explicit |
Looks like @hwillson has started grouping related issues under the refetch label -- just wanted to say thank you ahead of time, @hwillson. This class of issues has been responsible for the vast majority of apollo-implicated bugs in our production app over the past year -- it's so awesome that you're working on improving the behavior here. |
+1 |
I'm running into this issue (currently on the 2.5.0-alpha.10 of So something like this:
If I remove the For now I've resorted to removing the |
I had a similar problem in React Native and solved it. My problem was that Screen 1: export default graphql(gql`
query GetUsers {
users {
id
images {
id
url
}
}
}
`)(props => <Text>{props.data.users[0].id}</Text>) Screen 2: export default graphql(gql`
query GetUser {
user(id: 1) {
id
images {
# id <-- I did not fetch id in Screen 2
url
}
}
}
`)(props => <Text>{props.data.user.id}</Text>)
So I added Hope this helps. |
I am experiencing the same symptoms. As others have said, the issue is difficult to reproduce. When it does crop up it is very consistent for some time - it happened twice and each time I spent an hour trying to figure out what I broke (nothing) before things magically worked again. In my case, testing in an incognito window worked fine. On both occasions I was using my app simultaneously in a regular browser window (which was failing as per this issue) and an incognito window (which was working fine). Are other people experiencing this? Could it be that the cache (which I persist using AWS App Sync) can get into a particular state that makes this bug possible? |
Thanks for reporting this. Would you be able to provide a small runnable reproduction that demonstrates this problem and create a new issue? |
Intended outcome:
Previously cached query should reflect changes in intersecting mutation result.
Actual outcome:
If a mutation returns a previously cached object, but it only returns a subset of the previously cached fields, queries watching the previously cached object subsequently return empty
data
.How to reproduce the issue:
The user information in the
SessionQuery
will initially be cached and watched by theUserProfile
component. When theUpdateAvatarMutation
executes and returns, the query in theUserProfile
component will receive emptydata
. Several others have also observed this behavior and all traced it to an imperfect overlap between the queried/cached fields and the fields returned on the mutation (in this example,email
is missing from theUser
node on the mutation's returned results.Version
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
The text was updated successfully, but these errors were encountered: