Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutation Creators #160

Closed
3 tasks
abhiaiyer91 opened this issue May 1, 2016 · 5 comments
Closed
3 tasks

Mutation Creators #160

abhiaiyer91 opened this issue May 1, 2016 · 5 comments

Comments

@abhiaiyer91
Copy link
Contributor

This issue is to assign work surrounding the concept of Mutation Creators.

What are Mutation Creators?

Much like Action creators are functions that create actions, Mutation Creators are functions that create Mutations.

What needs to be done?

  • Need to figure out a clean way to recommend a pattern for using Mutation Creators.
  • Need to update example repos with this pattern
  • Need to update docs with recommendation
@abhiaiyer91
Copy link
Contributor Author

@jbaxleyiii
Copy link
Contributor

A few thoughts:

Performing validations in a component will certainly be a pattern (similar to allow and deny rules in some cases). I think a consistent way to do this is possible (and wanted), but probably wouldn't be part of the client itself.

The issue of needing to refetch (https://gist.github.com/abhiaiyer91/6c39108c1908261a708470710977d16a#file-dispatchmutation-js-L36-L38) should be solved in most cases by #144 but in the meantime having an easy way to do it is nice.

I'd rather return the promise directly instead of the callback.

From the gist, I gather the issues with the current implementation of mutations are:

  • how do I do validation
  • how do I trigger a watchQuery next() after the mutation

If those are the only issues, it may be worth discussing adding validate: (variables) => boolean on the mutation object? Since mutate() can be called as a function that passes its own args, you could certainly do it in the mutation function you define but it could be helpful / a clearer separation of concerns if done in its own method.

Aside from that we need to address #144 for sure

@abhiaiyer91
Copy link
Contributor Author

Yes exactly @jbaxleyiii

I think it would be valuable to give that utility for validation. I think most people will implement their same validations over and over again.

@jbaxleyiii
Copy link
Contributor

@abhiaiyer91 if you good with it, I'll open an issue around validation and close this one out?

@abhiaiyer91
Copy link
Contributor Author

Let's do it

jbaxleyiii pushed a commit that referenced this issue Oct 17, 2017
Simple typo, QL was not capitalized as it is declared.
jbaxleyiii pushed a commit that referenced this issue Oct 18, 2017
use typeof to check for redux devtools
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants