-
Notifications
You must be signed in to change notification settings - Fork 41
Feat tag-cache-filter #608
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
Conversation
🦋 Changeset detectedLatest commit: 58af07b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
.changeset/neat-hornets-call.md
Outdated
"@opennextjs/cloudflare": patch | ||
--- | ||
|
||
Add a new `withFilter` tag cache to allow to filter the tag cache used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new `withFilter` tag cache to allow to filter the tag cache used | |
Add a new `withFilter` tag cache to allow to filter the tags used |
expect(tagCache.getPathsByTags).toBeUndefined(); | ||
}); | ||
|
||
it("should properly filter soft tags", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it("should properly filter soft tags", () => { | |
it("should filter soft tags", () => { |
/** | ||
* The original tag cache. | ||
* Call to this will receive only the filtered tags. | ||
*/ | ||
originalTagCache: NextModeTagCache; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe?
/** | |
* The original tag cache. | |
* Call to this will receive only the filtered tags. | |
*/ | |
originalTagCache: NextModeTagCache; | |
/** | |
* The wrapped tag cache. | |
* Call to this will receive only the filtered tags. | |
*/ | |
tagCache: NextModeTagCache; |
/** | ||
* The function to filter tags. | ||
* @param tag The tag to filter. | ||
* @returns true if the tag should be forwarde, false otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @returns true if the tag should be forwarde, false otherwise. | |
* @returns true if the tag should be forwarded, false otherwise. |
|
||
/** | ||
* Creates a new tag cache that filters tags based on the provided filter function. | ||
* This is usefult to remove tags that are not used by the app, this could reduce the number of request to the underlying tag cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* This is usefult to remove tags that are not used by the app, this could reduce the number of request to the underlying tag cache. | |
* This is usefull to remove tags that are not used by the app, this could reduce the number of requests to the underlying tag cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a few minor comments
Add a new
withFilter
"tag cache" that allows to filter the tag used.It is mostly useful to reduce the load on the underlying tag cache.
It also introduce a
softTagFilter
function for those that usesrevalidateTag
, but notrevalidatePath