Prevent multiple call to store action from component

vuex
store-structure
components

#1

hello, how to prevent action loadCountryList in ~/store.js to be called multiple times from components ~/components/AddAddress.vue and ~/components/AddressItem.vue here is a working codesandbox knowing that i have to handle error from ajax call, and these components might be included as childs in multiple parent componenets the reason why i call loadCountryList()` in the componenet it self https://codesandbox.io/s/rqj81jjwo


#2

You call it once in your parent component (only place you really need to call it), then call it again, individually (n times) on your addressItem components. Otherwise, like you said you may for some reason need to individually call it else where, pass in a property that acts as a toggle.

But I feel like these components are simply dummy components, and the parent should pass this information to them.