0

I was trying to check the arguments of the updateQueries function to update the component's props with the new information, but it seems that the function is not being called, any idea why?

mutation toggleTodo($id: ID!) {
    toggleTodo(id: $id) {
        completed
    }
}

const withMutations = graphql(TOGGLE_TODO_MUTATION, {
    props: ({ ownProps, mutate }) => {
        return {
            onTodoClick: id => mutate({
                variables: { id },
                updateQueries: {
                    toggleTodo: (prev, { mutationResult }) => {
                        console.log(prev);
                        console.log(mutationResult);
                        return prev;
                    }
                }
            }),
            todos: getVisibleTodos(ownProps.todos, ownProps.filter),
            ...ownProps
        };
    }
});
  • Possible duplicate of [Apollo updateQueries Not Called?](http://stackoverflow.com/questions/40166659/apollo-updatequeries-not-called) – Renato Mar 05 '17 at 00:05

1 Answers1

0

This seems to be the same question as: Apollo updateQueries Not Called?

The answer is the same as well.

Community
  • 1
  • 1
helfer
  • 7,042
  • 1
  • 20
  • 20