Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a clearCache method to defaultMemoize output functions #519

Merged
merged 2 commits into from
Oct 21, 2021

Conversation

markerikson
Copy link
Contributor

This PR:

  • Updates defaultMemoize to enable clearing both singletonCache and lruCache
  • Exposes a clearCache method on the generated memoized function
  • Updates the createSelector types to infer the actual type of the memoize function's return value, so that selector.memoizedResultFunc.clearCache() is correctly inferred and usable

This allows correct inference of any fields that the memoize
function may attach to its generated output function, such as
`selector.memoizedResultFunc.clearCache` with `defaultMemoize`.
@codecov
Copy link

codecov bot commented Oct 21, 2021

Codecov Report

Merging #519 (d2721f4) into master (c9a5207) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #519   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          101       102    +1     
  Branches        24        24           
=========================================
+ Hits           101       102    +1     
Impacted Files Coverage Δ
src/defaultMemoize.ts 100.00% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant