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

feat: allow updating cache entries using a predicate function #56

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

swain
Copy link
Contributor

@swain swain commented Dec 11, 2024

Motivation

I'd like to be able to provide a predicate for updating cache entries, to allow updating all cache entries for an endpoint that match a particular pattern.

@swain swain force-pushed the cache-update-predicate branch from 4b99c20 to bf00472 Compare December 11, 2024 16:27
@swain swain marked this pull request as ready for review December 11, 2024 18:18
@swain swain merged commit c323cc9 into master Dec 11, 2024
4 checks passed
@swain swain deleted the cache-update-predicate branch December 11, 2024 21:01
Copy link

🎉 This PR is included in version 4.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Has been released to the package repository (NPM, etc) label Dec 11, 2024
Copy link
Member

@aecorredor aecorredor left a comment

Choose a reason for hiding this comment

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

Mainly wondering if this wasn't a breaking change.

/* istanbul ignore next */
return false;
}
const payloadInKey = keyPrefix ? queryKey[1] : queryKey[0];
Copy link
Member

Choose a reason for hiding this comment

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

The code was a little harder to follow now - maybe a good doc comment above the line 51 would help parse this a bit quicker.

keyPrefix,
createQueryKey(name, route, payloadOrPredicate),
].filter(Boolean),
exact: true,
Copy link
Member

Choose a reason for hiding this comment

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

Why did we need exact now, when we didn't have it before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Has been released to the package repository (NPM, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants