Skip to content

MapGetters not working for modules with namespaced=true in vuex  #1553

@Xambey

Description

@Xambey

Version

3.1.1

Reproduction link

https://gitlab.com/Xambey/large

Steps to reproduce

  1. Run the application.
  2. Open console in web browser (or vue extensions)
  3. Catch the error in the log (ChildA.vue: 14 )

"Property or method "score" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property"

found in

---> at src/components/ChildA.vue
at src/components/Parent.vue
at src/App.vue

What is expected?

The getter 'score' is created in my component. (this.$store.getters['scoreBoard/score'] -> this.score)

What is actually happening?

Getter no mapped, vue google chrome extension show what state existed https://i.imgur.com/QKB7Wqm.png


computed: {
    ...mapGetters([
      'scoreBoard/score' // Not found when /scoreBoard/score is existed. 
    ])
  }

if you do this, then everything works (or namespaced = false):

computed: {
    ...mapGetters({
      score: 'scoreBoard/score'
    })
  }

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