@client @export $variable not refetching Query when state changes
See original GitHub issueIntended outcome:
When using local @client
state as a query variable via @export
I would expect that changing that state would cause the query to re-run (as the variable has changed and it shouldn’t be in cache).
Actual outcome:
The query does not re-run. Using @client(always: true)
doesn’t help, nor does changing fetchPolicy
.
How to reproduce the issue:
Using Query
component (haven’t tried as a HOC) write a query using @client @export
, and inside that component have some event change client state with writeData
. The query will not re-run.
However doing something else to cause the component to re-render will cause the query to re-run, it’s just not automatically tracked by Apollo. In the example I increment the Query component’s key
to force it to re-render, and then Apollo re-fetches the query with the new state.
https://codesandbox.io/s/o57v4x1x25
Versions
System:
OS: macOS 10.14.3
Binaries:
Node: 11.9.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
Browsers:
Chrome: 72.0.3626.119
Safari: 12.0.3
npmPackages:
apollo-cache-inmemory: ^1.5.1 => 1.5.1
apollo-client: ^2.5.1 => 2.5.1
apollo-link-http: ^1.5.9 => 1.5.11
react-apollo: ^2.4.1 => 2.5.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:27 (10 by maintainers)
Top GitHub Comments
…any update on this ?
Sorry to hear of your frustration @jide! I’ll post back with an update on this shortly (I’m tackling this and a few other 2.5 issues today). Thanks!