Skip to content
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

Mutations doesn't show up in Vue devtools #105

Open
evry-johan opened this issue Jun 8, 2020 · 4 comments
Open

Mutations doesn't show up in Vue devtools #105

evry-johan opened this issue Jun 8, 2020 · 4 comments
Assignees
Labels

Comments

@evry-johan
Copy link

Hi, first of all, thanks for a great package, just what I was looking for.

I'm just curious why the mutations doesn't show up in Vue devtools? The state seems to be updated correctly

@maoberlehner
Copy link
Owner

Maybe you're mutating your state directly?

Usually vuex-map-fields mutations do show up in devtools.

@evry-johan
Copy link
Author

evry-johan commented Jun 8, 2020

@maoberlehner Currently, this is what I'm doing:

component:

import { createHelpers } from 'vuex-map-fields'
const { mapFields } = createHelpers({
  getterType: 'order/getField',
  mutationType: 'order/updateField'
})

export default {
  computed: {
    ...mapFields(['list'])
  }
}

the order store module:

import { getField, updateField } from 'vuex-map-fields'

const state = {
  list: []
}

const mutations = {
  updateField
}

const actions = {

}

const getters = {
  getField
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}

Shouldn't I be able to manipilate the mapped field list from my component? I pushed an item to it in the mounted callback just to test.

The bindings seems to work as expected for primitive store values like a string.

@evry-johan
Copy link
Author

@maoberlehner I guess this is related to #65 and #74. Is the current solution to add custom splice and push mutations for such actions?

@geoidesic
Copy link
Collaborator

geoidesic commented Sep 8, 2020

@evry-johan can you create a codesandbox instance to highlight the issue? It's not really clear what you're struggling with. First you mentioned mutations not showing up in vue dev tools then you mentioned being able to manipulate, which sounds like a different issue?

You haven't shown your template code but my guess is that you are trying to manipulate the contents of an array that is mapped via mapFields, which won't work. You need to use mapMultiRowFields.

See https://github.com/maoberlehner/vuex-map-fields#multi-row-fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants