[Vuejs]-Unable to retrieve mutated data from getter

0👍

There is race condition. actionSubscribersData is async and returns a promise. It should be waited for until data becomes available:

  async mounted() {
    await this.actionSubscribersData();
    this.renderGraph(this.getterSubscribers);
  }

0👍

There must be delay for the actionSubscribersData action to set value to store. Better you make the action async or watch the getter. Watching the getter value can be done as follows

watch:{
  getterSubscribers:{ // watch the data to set
    deep:true,
    handler:function(value){
      if(value){ // once the data is set trigger the function
        this.renderGraph(value);
      }
    }
  }
}

Leave a comment