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

BREAKING(cache/unstable): configurable cache ejection of thrown or rejected values, change cache type (#6417) #6419

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lionel-rowe
Copy link
Contributor

Closes #6417.

I don't love how verbose this makes passing an LruCache instance as a memoize option. Ideally it'd be possible to just pass it as a literal { cache: new LruCache(100) } with the type params being inferred as what they're supposed to be, but I don't think it's possible to do that in TypeScript (???). Passing { cache: new Map() } works, but only because new Map() is Map<any, any>, whereas new LruCache(n) is LruCache<unknown, unknown>.

@lionel-rowe lionel-rowe requested a review from kt3k as a code owner February 18, 2025 09:50
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.04%. Comparing base (360851f) to head (c33585a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6419   +/-   ##
=======================================
  Coverage   96.03%   96.04%           
=======================================
  Files         562      562           
  Lines       42418    42439   +21     
  Branches     6387     6395    +8     
=======================================
+ Hits        40738    40762   +24     
+ Misses       1641     1638    -3     
  Partials       39       39           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kt3k kt3k changed the title feat(cache/unstable): configurable cache ejection of thrown or rejected values (#6417) BREAKING(cache/unstable): configurable cache ejection of thrown or rejected values, change cache type (#6417) Feb 20, 2025
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k
Copy link
Member

kt3k commented Feb 20, 2025

I'll keep this PR open for a while to see if there are more feedbacks

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.

(unstable) cache/memoize: Make caching of rejected promises (and maybe thrown errors?) configurable
2 participants