[Vuex] Best practice for computed getter with setter

Hey guys, I have the following problem:

I have a form page with lots of form fields and all their values are maintained in Vuex store. Due to complex business logic, some form fields depend on other form fields and are implemented as computed getters in store. However, business logic also requires that user is also able to enter these values manually (since there are certain factors which algorithm for computing values can’t predict - DON’T ASK xD). Therefore, this requires also creating a setter for those computed values and my question is what is the best approach for solving this? Should I create another field in store with same name as computed getter or there is a better solution for this?

Setters seems like a right approach. But i recommend you create a local copy in the component making a change, then sync with the store when changes are finalised.

1 Like

Thank you man!