1👍
✅
When setting up your VueApollo
instance, you could pass a watchLoading
hook that watches all queries:
const apolloProvider = new VueApollo({
watchLoading (isLoading, countModifier) {
loading += countModifier
console.log('Global loading', loading, countModifier)
},
//...
})
The property is documented in Smart Query options:
watchLoading(isLoading, countModifier)
is a hook called when the loading state of the query changes. ThecountModifier
parameter is either equal to1
when the query is loading, or-1
when the query is no longer loading.
Source:stackexchange.com