Data disappears between two queries of the same type. UI updates with empty props.
See original GitHub issueI am using react-apollo
and the <Query>
component.
Intended outcome:
Execute two queries (A
and B
) in series over the same root field (article
) and with a shared sub-query (image
). There are fewer fields on the image
sub-selection in query B
than on image in query A
. The image id
changes upstream between the execution of the two queries, so the data responses will be slightly different for the two queries.
First query:
query A {
article {
id
image {
id
src
}
}
}
Later query (triggered after a user interaction):
query B {
article {
id
title
image {
id # This id has changed since query A was executed
}
}
}
The <Query>
component that is subscribing to query A
should either get updated with new data after B
is completed, or ignore the data from B
if it’s inconsistent with A
.
Actual outcome:
The query component that is subscribing to A
is re-rendered without the data
prop.
How to reproduce the issue: https://codesandbox.io/s/0xl9v5znnw
Versions “apollo-cache-inmemory”: “1.2.10” “apollo-client”: “2.4.2” “react-apollo”: “2.1.11”
Possibly related https://github.com/apollographql/apollo-client/issues/3267 https://github.com/apollographql/react-apollo/pull/2003
Issue Analytics
- State:
- Created 5 years ago
- Reactions:25
- Comments:8 (4 by maintainers)
Top GitHub Comments
This is a serious problem
@helfer In my mind
partialRefetch
makes sense as a default if issues like these cannot be mitigated in another way. However, it would be helpful to get some feedback when a scenario like I posted above occurs. A console warning at the least. Currently it fails silently.