data-provider / core

Async data provider agnostic about data origins
https://data-provider.javierbrea.com
Apache License 2.0
56 stars 1 forks source link

Allow to clean all dependencies cache except defined ones #121

Closed javierbrea closed 4 years ago

javierbrea commented 4 years ago

Sometimes you need to clean all dependencies of a Selector, except some specific ones. (A usual use case is when a dependency of the selector is an origin requesting user data, that could be reused by a lot of other Selectors. Then, you don't wan't to clean that cache, because it will recalculate lots of selectors unnecessarily).

To achieve this, the cleanDependenciesCache method could accept an options argument. That argument could be an object containing an except property, that should be an array containing those origins or selectors that you don't want to be cleaned.

selector.cleanDependenciesCache({
   except: [origin]
})