maoberlehner/vuex-map-fields

FEATURE REQUEST: Provide debug info on updateField

maxcorbeau opened this issue · 1 comments

First thanks so much for this project, what a time saver....

I was wondering if Vue/Vuex architecture would allow to do the following: whenever updateField is called, **automatically feed an additional debug property in the payload (along with the existing path and value), so we know "where" the mutation happened from, for instance by providing the names of the component/methods etc...:

For instance, MyApp.vue:

computed: {
    ...mapFields([
      'item',
    ]),
  },
methods: {
   change_item() {
     // creates obj
     this.item = obj
   }
}

Current view with Vue debugger:
before

With the debug property added:
after

vue-map-fields is a great tool to save time, but the side-effect is that when used across multiple components it becomes hard to trace back which component is responsible for which mutations, having the debug info would solve that problem.

the side-effect is that when used across multiple components it becomes hard to trace back which component is responsible for which mutations

This is a compromise that you make when you use this package. If you want to be able to track exactly where which state mutation is triggered, you should use custom mutations. This is one of the main reasons why the state is modified via mutations in Vuex and similar packages.