Intended outcome:
QueryManager has a refetchQueryByName function so we can refetch a query by name manually.
Actual outcome:
refetchQueryByName function was removed at some point introducing an undocumented BC break.
How to reproduce the issue:
Call client.queryManager.refetchQueryByName("QueryName")
Versions
System:
OS: macOS 10.14.5
Binaries:
Node: 8.15.1 - ~/.nvm/versions/node/v8.15.1/bin/node
Yarn: 1.13.0 - ~/.nvm/versions/node/v8.15.1/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.15.1/bin/npm
Browsers:
Chrome: 76.0.3809.132
Firefox: 60.0.2
Safari: 12.1.1
npmPackages:
apollo-client: ^2.6.4 => 2.6.4
apollo-client-preset: ^1.0.8 => 1.0.8
apollo-link-error: ^1.1.11 => 1.1.11
react-apollo: ^3.0.1 => 3.0.1
npmGlobalPackages:
apollo: 2.15.0
I also noticed this now when I was debugging an unrelated issue. When I inspected the object, I don't see the function anymore.

I'm running into the same issue. Was this method removed on purpose? Is there a plan to add it back?
Is there at least a workaround?
I created a workaround using a local resolver/mutation that does nothing:
resolver:
export const client = new ApolloClient({
link: ApolloLink.from([loggerLink, errorLink, httpLink]),
cache,
resolvers: {
Mutation: {
doNothing: () => { return null; } // hack to be able to use refetchQueries
}
},
});
mutation:
mutation {
doNothing @client
}
usage:
// to refetch Query1 and Query2
client.mutate({ mutation: DO_NOTHING_MUTATION, refetchQueries: () => ["Query1", "Query2"] });
Most helpful comment
I'm running into the same issue. Was this method removed on purpose? Is there a plan to add it back?