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
[Feature Request] Add mapFields #1547
Comments
Take a look at Vuex Pathify: https://github.com/davestewart/vuex-pathify It does what you mention above and also can reach in to object properties without having to physically create separate mutations as you have with In pathify you would write: computed: sync('search', [
'query',
'options@includeFiles',
'options@ignoreCase',
]) |
@davestewart thanks for letting me know about it, |
I can't speak on behalf of the authors, but my impression is that a) it was always meant to be explicit with top-level mutations b) they didn't want to deviate too far from the recognised Flux pattern. There's not insignificant feeling in the community that Vuex / Flux is overkill for a lot of state management work. My hope is that over the next while we'll see even better / more flexible / less onerous state management patterns emerge, with Vuex / Flux being a stepping stone to them. |
Vuex should definitely have something like this. Sure, for some things it makes sense to handcraft getters and setters, but writing a hundred trivial getters/setters get old very quickly. The trivial cases should be easy and they should not introduce tons of completely useless code. The good thing about things like And it should definitely be part of Vuex itself. Having 2nd-level dependencies is already a bit iffy, but 3rd-level is quite a no go – at least for me, since the likelihood of some library becoming unmaintained or simply not keeping up with upstream developments is getting more likely the further down your dependency tree goes. |
Any thoughts on this issue, guys? I agree with @qwesda, what if It would be really nice to have an option to let |
There're lots of discussion trying to make |
What problem does this feature solve?
Right now, you cannot use nested properties in
v-model
without writing a ton of unnecessary computed objects for each property:Current way:
But it would be much better to just do it like this:
A better way:
What does the proposed API look like?
There's a module called
vuex-map-fields
, perhaps it would make sense to add something like this to Vuex?:The text was updated successfully, but these errors were encountered: