How to force Apollo Query component to re-run query when parent component re-renders
How to force Apollo Query component to re-run query when parent component re-renders I'm using Apollo Client's <Query> within a component that is re-rendered when state is changed within a lifecycle method. I wish to have my <Query> component re-run the query because I know that data has changed. It appears that Query component is using a cache that needs to be invalidated before query is re-run. <Query> <Query> I'm using a wonky workaround that caches the refetch callback from the render prop in the parent component, but it feels wrong. I'll post my approach in the answers if anyone is interested. refetch My code looks something like this. I removed loading and error handling from query as well as some other detail for brevity. loading error class ParentComponent extends React.Component { componentDidUpdate(prevProps) { if (this.props.refetchId !== prevProps.refetchId) { const otherData = this.processData() // do something ...