Add support for cache: 'while-pending' option
#61
+42
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #53
This PR adds support for
cache: 'while-pending'as a more readable alternative tocache: falsefor disabling result caching while still deduplicating concurrent in-flight requests.Problem
Previously, to enable in-flight deduplication without persistent caching, users had to write:
The
cache: falsesyntax is not self-documenting and requires comments to clarify its behavior.Solution
This PR implements
cache: 'while-pending'as discussed in the issue comments:This is much more readable and self-explanatory - it clearly indicates that results are only memoized while the promise is pending (in-flight), but not after resolution.
Implementation Details
Optionstype now acceptscache: 'while-pending'in addition tofalseand cache storage objects'while-pending'is normalized tofalsefor processing, maintaining all existing behaviorcache: falseandcache: 'while-pending'behave identically - they disable persistent caching but still deduplicate concurrent requestscache: falsecontinues to work unchangedChanges
'while-pending'as a cache option'while-pending'the same asfalseAll tests pass (27/27) ✅
Original prompt
Fixes #53
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.