-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Description
Issue Description
I have a strange issue where two successive calls to fetchMore will cause a bug only if the query was changed once before.
Reproduction outline
fetchpolicy = "network-only"- paginating with a:
- custom merge function
- custom read function
- query can be updated to include one extra field of the same object
- make three requests of 10 items each as soon as:
- page loads (β no problem)
- query updates (π bug)
Link to Reproduction
Reproduction Steps
- Press the "change query" button
Result:datareturned fromuseQueryis stale, despite sequential calls tofetchMore(fetchMoreupdates not present).
Example workarounds:
- Reduce the number of times
fetchMoreis called, (instead of two times just one time: change line 46 - change number30to20) - In the merge function, if the query is changed (detect by:
incomingis first ten items), then throw away the merged result and return onlyincoming - In the original query, call more than one field. In the updated query, call fewer of those fields (seems to return cached result despite using
"network-only")
@apollo/client version
3.9.5
Athelian, maxchou415, ShouShou92410, carlos-labrador and AngusLeck