data-provider/core

Allow to clean all dependencies cache except defined ones

Closed this issue · 0 comments

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]
})