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
Workflow for clone and save Model with associations #278
Comments
addressClone.commit() // Updates the store and parts of UI displaying the record.
addressClone.save() // Sends update to server, which can take however much time to respond. |
const customerClone = customer.clone()
addressClone = customerClone.addresses[0].clone() Pass the cloned address to some address editor component. Setup the component to |
When I use the diffOnPatch method it is necessary to call |
@fratzinger that's correct. The simplest implementation of a |
I've added this to the docs for version 3.0, to be release within the next couple of days. |
Steps to reproduce
I got a simple setup for models:
customers
andaddresses
and a custom component in which I input the data. This component I use for new data as well as changing data. Here is an example how thecustomers
-model is set up:Now I want to use the
clone
/reset
/commit
/save
-workflow with thediffOnPatch
-function. To make temporare changes and discard them or save them I usethis.customer.clone()
andsave()
orreset()
which works perfect for directcustomer
-fields likecompany
/fullName
/... but obviously not for the associatedcustomer.address
-fields likestreet
/zipCode
/...Here are my questions:
customer
it seems to make sense to me thatcustomer.address
is also a copy. Do you agree? Is this something worth implementing? Maybe by passing theoptions
-object tosetupInstance
.customer.address
without programming to much? I want to keep my custom component clean because I use it also for new data whereclone
doesnt make sense.commit
at all?Do you had the use case of nested clones and how did you solve this? Maybe it's more about documentation of the
clone
-workflow than new code.Any help or hints are kindly appreciated. If there is a code idea which can be baked into feathers-vuex I would be happy to help with this.
Thanks in advance.
Module versions (especially the part that's not working):
The text was updated successfully, but these errors were encountered: