This beta release updates defaultMemoize
with the ability to clear cache for a memoized function, and updates the TS types of createSelector
to correctly infer the type of the function returned from the memoizer.
We would appreciate any feedback on the behavior of the new features and compatibility of the TS types, in preparation for a final 4.1.0 release.
npm i reselect@next
yarn add reselect@next
Changelog
defaultMemoize
Cache Clearing
defaultMemoize
now supports clearing the cache inside a memoized function. The memoized function returned from defaultMemoize
will now have a .clearCache()
method attached that will clear the cache.
When using createSelector
, this can be accessed using selector.memoizedResultFunc.clearCache()
.
createSelector
TypeScript Return Type Inference Improvements
createSelector
should now fully infer the type of the memoized function returned by the memoize
parameter. This means that standard use of createSelector
, which already has defaultMemoize
built in, will also correctly infer the existence of selector.memoizedResultFunc.clearCache()
.
What's Changed
- Add a
clearCache
method to defaultMemoize output functions by @markerikson in #519 - chore(repo): update all deps by @peter-mouland in #518
New Contributors
- @peter-mouland made their first contribution in #518
Full Changelog: v4.1.0-alpha.2...v4.1.0-beta.0