fetchMore's updateQuery option receives the wrong variables
See original GitHub issueThe updateQuery
method passed to ObservableQuery.fetchMore
is receiving the original query variables instead of the new variables that it used to fetch more data.
This is problematic not so much because it breaks the updateQuery
method contract (which is bad, but clearly doesn’t seem to impact many people), but rather because when the results from fetchMore
are written to the store in writeQuery
, the old variables are used. This cases issues, say, if you were using an @include
directive and the variable driving its value changes.
Repro is available here: https://github.com/jamesreggio/react-apollo-error-template/tree/repro-2499
Expected behavior
nextResults.variables
shows petsIncluded: true
and the pets
list gets displayed.
Actual behavior
nextResults.variables
shows petsIncluded: null
and the pets
list is not displayed because the write never happens due to the @include
directive being evaluated with the old variables.
Version
- apollo-client@2.0.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:30
- Comments:52 (13 by maintainers)
Here’s a GIF to keep this open.
@jbaxleyiii any update on this at all please?
Kind regards,