title: Apollo-client (react) - Update on create mutation - "Can't find field Fund({}) on object (ROOT_QUERY)"
body: <p>Using: "react-apollo": "^1.4.3"</p>
  
  <p>In the parent component I query using GraphQL a parent node 'Fund' with children 'fundQuarterlyMetric'. This returns data in the following format:</p>
  
  <pre><code>{      
    id
    name
    ...
    fundQuarterlyMetrics (orderBy: asAtDate_ASC) {
      id
      year
      quarter
      ...
    }
  }
  </code></pre>
  
  <p>When I try to create a new fundQuarterlyMetrics I have to update the local store on react-apollo using the update feature (<a href="http://dev.apollodata.com/react/cache-updates.html#directAccess" rel="noreferrer">Apollo Client docs</a>). It gives me an error:</p>
  
  <pre><code>   Can't find field Fund({}) on object (ROOT_QUERY) {
       "Fund({\"id\":\"cj57hpfips0x7014414u5tk8m\"})": {
       "type": "id",
       "id": "Fund:cj57hpfips0x7014414u5tk8m",
       "generated": false
      }
  </code></pre>
  
  <p>The thing is, is that when I console.log the proxy, I can see the Fund and it's children under data.... not sure what to do..</p>
  
  <p>UPDATE following comment:</p>
  
  <p>Here is the parent component data request:</p>
  
  <pre><code>export const fundPageQuery = gql`
   query Fund($fundId: ID!) {
  Fund(id: $fundId) {
    id
    name
    ....other variables
    fundQuarterlyMetrics (orderBy: asAtDate_ASC) {
      id
      year
      quarter
      ....other variables
    }
  }
  </code></pre>
  
  <p>}
      `;</p>
  
  <p>Here are the options I used:</p>
  
  <pre><code>var optionsForCreateFundMetric = {
   update: (proxy, {data: {createFundMetrics}}) =&gt; {
   try {
    console.log('proxy', proxy);
    const data = proxy.readQuery({query: FundQL.fundPageQuery});
    console.log('data', data);
    data.Fund.fundQuarterlyMetrics.push(createFundMetrics);
    proxy.writeQuery({query: FundQL.fundPageQuery, data})
  } catch (e) {
    console.log('error adding to store', e);
  }
  </code></pre>
  
  <p>}
      };</p>
  
  <pre><code>export default compose(
   graphql(FundQL.createFundMetrics, {name: 'createFundMetrics', options: 
   optionsForCreateFundMetric}),
   graphql(FundQL.updateFundMetrics, {name: 'updateFundMetrics'})
   )(FundMetricsForm);
  </code></pre>
  
  <p>Here is my create mutation:</p>
  
  <pre><code>export const createFundMetrics = gql`
   mutation createFundQuarterlyMetric(
  $fundId: ID
  $year: Int!
  $quarter: FUND_QUARTERLY_METRIC_QUARTER!
  $netIRR: Float!
  $tvpi: Float!
  $rvpi: Float!
  $dpi: Float!
  $asAtDate: DateTime
  $calledThisQuarter: Float!
  $distributedThisQuarter: Float!
  $cumulativeCalled: Float!
  $cumulativeDistributed: Float!
  $limitedPartnersNAV: Float!
  $quarterlyValuationChangeLCY: Float
  $quarterlyTotalReturn: Float
   ) {
  createFundQuarterlyMetric(
    fundId: $fundId
    year: $year
    quarter: $quarter
    netIRR: $netIRR
    tvpi: $tvpi
    rvpi: $rvpi
    dpi: $dpi
    asAtDate: $asAtDate
    calledThisQuarter: $calledThisQuarter
    distributedThisQuarter: $distributedThisQuarter
    cumulativeCalled: $cumulativeCalled
    cumulativeDistributed: $cumulativeDistributed
    limitedPartnersNAV: $limitedPartnersNAV
    quarterlyValuationChangeLCY: $quarterlyValuationChangeLCY
    quarterlyTotalReturn: $quarterlyTotalReturn
  ) {
    id
    year
    quarter
    netIRR
    tvpi
    rvpi
    dpi
    asAtDate
    calledThisQuarter
    distributedThisQuarter
    cumulativeCalled
    cumulativeDistributed
    limitedPartnersNAV
    quarterlyValuationChangeLCY
    quarterlyTotalReturn
  }
  </code></pre>
  
  <p>}
  `;</p>
  
  <p>SOLUTION
  Thanks Daniel - I had to return the fund ID to make it work so thank you!</p>
  
  <pre><code>export default compose(
   graphql(FundQL.createFundMetrics, {name: 'createFundMetrics', options: 
  optionsForCreateFundMetric, variables: {fundId: 
  createFundQuarterlyMetric.fund.id}}),
   graphql(FundQL.updateFundMetrics, {name: 'updateFundMetrics'})
   )(FundMetricsForm);
  </code></pre>