2017-03-01 64 views
0

我試圖檢查updateQueries函數的參數來更新組件的道具與新的信息,但似乎該函數沒有被調用,任何想法爲什麼?Apollo反應突變updateQuery不調用

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 
     }; 
    } 
}); 
+0

可能重複[Apollo updateQueries Not Called?](http://stackoverflow.com/questions/40166659/apollo-updatequeries-not- called) – Renato

回答