Skip to content

mapState doesn't work with non namespaced module #1592

Open
@Rolanddoda

Description

@Rolanddoda

Version

3.1.1

Reproduction link

https://codesandbox.io/s/vuex-issue-with-mapstate-5zb3x

Steps to reproduce

In the reproduction link, there is a non namespaced module with has a count in it's state and a doubleCount in it's getters.

In the HelloWorld component I am trying to use vuex helpers to access the state and the getters like:

...mapState(['count']),
...mapGetters(['doubleCount]')

What is expected?

Since the module it's not namespaced I should be able to access the state and getters of the module with vuex helpers.

Both mapState and mapGetters should work fine.

What is actually happening?

However, only the mapGetters helper it's working.


In order to get the mapState to work I should do:

    ...mapState({
      count: state => state.myModule.count
    })

However IMHO, the mapState should work with just a string since the module in the end it's merged with the global store.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions