0👍
✅
Instead of attempting to access the loadedProducts
via store
, instead access it through the getters themselves. The docs on getters provide an example of accessing other getters within a getter via the second argument.
Getters will also receive other getters as the 2nd argument
loadedProduct (state, getters) {
return (productId) => {
return getters.loadedProducts.find((product) => {
return product.partNumber === productId
})
}
}
Be sure you are setting reasonable defaults for your store properties such as an empty array for products
.
Hopefully that helps!
Source:stackexchange.com