'Is it possible to rely on computed-properties-mapped-getter-values inside a created block in a Vue instance?
Would like to know if - by the time - accessing a computed property which get its value from the store - inside a created block - I can be sure that the computed value is already initiated.
async created(){
!this.apps.length && await this.loadApps();
},
computed: {
...mapGetters('apps-store', ['apps']),
},
Solution 1:[1]
Hooks are just functions that get fired on proper times - they are announcement not middleware. So, async hook does not wait to being fulfilled. You should provide a default value for the app getter __ either in the getter function or its state.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mr. R |
