javascript - Relay Error when deleting: RelayMutationQuery: Invalid field name on fat query -


i'm running issue when attempt commit deletion mutation. when commit, error uncaught invariant violation: relaymutationquery: invalid field name on fat query, `company`.. viewing, creating , updating nodes work. reason can't delete. mentions company field in fatquery, field have in fat query deleteduserid server. in advance!

component:

import react, {component} 'react'; import relay 'react-relay'; import {link} 'react-router'; import deleteusermutation 'mutations/deleteusermutation'; import styles './employeeitem.css';  class employeeitem extends component {   render() {     const {user} = this.props;     return (       <div classname={styles.employee}>         <p><strong>id:</strong> {user.id}</p>         <p><strong>first name:</strong> {user.firstname}</p>         <p><strong>last name:</strong> {user.lastname}</p>         <p><strong>email:</strong> {user.email}</p>         <div classname="btn-group">           <link to={`/company/employees/${user.id}`} classname="btn btn-primary">view employee</link>           <button onclick={this.handleremove} classname="btn btn-danger">delete user</button>         </div>       </div>     )   }    handleremove = (e) => {     e.preventdefault();     const {user, company} = this.props;      relay.store.commitupdate(new deleteusermutation({user, company}));   }; }  export default relay.createcontainer(employeeitem, {   fragments: {     company: () => relay.ql`       fragment on company {         id         ${deleteusermutation.getfragment('company')}       }     `,     user: () => relay.ql`       fragment on user {         id         firstname         lastname         email         ${deleteusermutation.getfragment('user')}       }     `   } }); 

mutation:

import react 'react'; import relay 'react-relay';  export default class deleteusermutation extends relay.mutation {   static fragments = {     company: () => relay.ql`       fragment on company {         id       }     `,     user: () => relay.ql`       fragment on user {         id       }     `   };    getmutation() {     return relay.ql`mutation {deleteuser}`;   }    getfatquery() {     return relay.ql`       fragment on deleteuserpayload {         deleteduserid       }     `;   }    getvariables() {     return {       id: this.props.user.id,     }   }    getconfigs() {     return [{       type: 'node_delete',       parentname: 'company',       parentid: this.props.company.id,       connectionname: 'employees',       deletedidfieldname: 'deleteduserid'     }]   }    // wasn't sure if causing error appears    // else.   // getoptimisticresponse() {   //   return {   //     deleteduserid: this.props.user.id   //   }   // } } 

this error referring fact reference "company" in getconfigs() implementation. node_delete config tells relay how construct mutation query mapping nodes in store (e.g. parentid) fields on fat query (e.g. parentname).

although might not need today, should add company mutation payload & fat query here, since company is being affected change. more specifically, company's employees connection being modified :)


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -