caching - Update method in mutation not running -
i have following component mutates data. apollo provides functionality update store automatically. control way data added store using update function. documentation straightforward enough, can't working. wrong in code below prevent console.log
printing.
import react 'react' import { connect } 'react-redux'; import { graphql, gql, compose } 'react-apollo'; import { personcodeselector } '../../selectors/auth'; import uploadbankstatement '../../components/eftfileuploads/uploadbankstatement.jsx'; const createeftfileupload = gql`mutation createeftfileupload( $bankaccountcode: string!, $uploadinput: uploadinput!, $uploadedbypersoncode: string!) { createeftfileupload( bankaccountcode: $bankaccountcode, uploadinput: $uploadinput, uploadedbypersoncode: $uploadedbypersoncode) { id bankaccountcode filename numberofprocesseditems numberofunallocateditems createdat status } }`; const mutationconfig = { props: ({ ownprops, mutate }) => ({ createeftfileupload: (bankaccountcode, uploadinput) => { return mutate({ variables: { bankaccountcode, uploadinput, uploadedbypersoncode: ownprops.personcode }, update: (store, something) => { console.log("ping"); console.log(store, something); }, }); } }) }; const mapstatetoprops = state => { return { personcode: personcodeselector(state) }; }; export default compose( connect(mapstatetoprops), graphql(createeftfileupload, mutationconfig) )(uploadbankstatement);
note have found couple of similar issues, doesn't seem shed light on situation.
server restart fix issue. not sure why required hot-reloading. code correct.
Comments
Post a Comment