Skip to content

Does Vuex work with new Map(), as in key/value map lists? #439

Closed
@Sarke

Description

@Sarke

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

My state for a module looks like this:

const state = {
	loaded: false,
	items: new Map(),
}

I'm having some issues when updating an item in the list through a mutation, that it doesn't propagate through to the Vue component. In the component I have:

computed: {
	item() {
		return this.$store.state.module.items.get(this.pk)
	},
},

Am I using this wrong, or does Vuex not support Map()? If it's not supported, where would be a good place to put a load(pk) method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions