Ok, so I’ve been playing with the idea of Mutation support for cells and have been poking around a bit
Hacking a one line change (ok, 2, if you count importing useMutation) in createCell.tsx will call the useMutation instead of the useQuery (if you code a mutation into the QUERY)
I made this change in the distributed createCell.js and it called useMutation, but then it complains that the data return is null and it cannot render Success
@ajoslin103 when would use a mutation cell? I am having a hard time wrapping my head around a use case. With a Cell / Query we want to fetch some data on the component mount. But when would you Mutate data on a component on mount?
@KrisCoulson I am having a similar amount of trouble trying to figure out how to use mutations in my applications as easily as queries
When I want to do something in response to a user action I set a flag to mount components which show progress until they are done, then their completion dismounts them
So the user can click to save when they have made changes… Errors are displayed and they could still attempt to save their changes again… Saving displays an indeterminate progress indicator…
yeah but you can do all of that with the useMutation hook. There’s some documentation for form errors here and you can check out the apollo useMutation documentation for all of the options you can pass to useMutation.
I love the sound of this, it feels like the right way to do things - but it’s a bit raw and doesn’t feel Redwood to me. I can generate a cell, I’d like to be able to generate a mutation.
My sense of symmetry wants mutators to be wrapped in something - it’s like the QUERY has this great Cell wrapper and the MUTATION’s somewhere on the coffee table the morning after the party
Bringing back an old topic. As far as a use case of when you would want to do a mutation on load of a page… What about a verification page. Where the user clicks on a link from an email that should verify their account. The idea is the link will take them to a private page that once loaded verifies their account without them having to do anything else. The page would either spit out a success message or an error message.