Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Pass mutateFn variables to update #2868

Closed
adrienharnay opened this issue Mar 14, 2019 · 1 comment
Closed

Pass mutateFn variables to update #2868

adrienharnay opened this issue Mar 14, 2019 · 1 comment

Comments

@adrienharnay
Copy link

adrienharnay commented Mar 14, 2019

Intended outcome:

It is currently impossible (to my knowledge) to access the variables used in a mutation in the update function:

<MutateFunction update={(proxy, { data }) => { doSomething(); }>
  {mutate => (
    <>
      <div onClick={() => { mutate({ variables: id: 1 } }); }} />
      <div onClick={() => { mutate({ variables: id: 2 } }); }} />
    </>
  )}
</MutateFunction>

Actual outcome:

Sometimes to properly update the cache we need to access the variables (e.g. we delete something on the server and it returns a 204 / Boolean, so we can't access the payload to guess the variables).

How to reproduce the issue:

I think the code above is pretty self-explanatory. Let me know if you need more context though!

Version

  • apollo-client@2.5.1
  • react-apollo@2.5.2

Thanks in advance!

@hwillson
Copy link
Member

hwillson commented Jun 15, 2019

To help provide a more clear separation between feature requests and bugs, and to help clean up the feature request backlog, React Apollo feature requests are now being managed under the https://github.com/apollographql/apollo-feature-requests repository.

Migrated to apollographql/apollo-feature-requests#113.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants