superwf / vuex-cache

cache vuex action when dispatch
MIT License
510 stars 32 forks source link

Caching Rejected Promise #7

Closed eele94 closed 6 years ago

eele94 commented 6 years ago

Should a rejected promise be cached or skipped?

superwf commented 6 years ago

I think it for a while, and the result is rejected promise should be cached. In a short time, the store.cache.dispatch may be revoked many times, but the promise is cached to ensure it run only once. And in the promise.catch function, run store.cache.delete to remove the cache.