Skip to content

[cloudflare]: add docs for withFilter #132

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

Merged
merged 4 commits into from
Apr 28, 2025

Conversation

conico974
Copy link
Contributor

@conico974 conico974 requested review from james-elicx and a team as code owners April 28, 2025 14:56
</Tabs.Tab>
<Tabs.Tab>
<Callout>
The withFilter option is a specialized configuration that enhances your tagCache by layering an additional filter. It requires another tag cache to be passed in as the originalTagCache (e.g., `d1NextTagCache`, `doShardedTagCache` or your own).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The withFilter option is a specialized configuration that enhances your tagCache by layering an additional filter. It requires another tag cache to be passed in as the originalTagCache (e.g., `d1NextTagCache`, `doShardedTagCache` or your own).
The `withFilter` option is a specialized configuration that enhances your `tagCache` by layering an additional filter. It requires another tag cache to be passed in as the originalTagCache (e.g., `d1NextTagCache`, `doShardedTagCache` or your own).

Copy link
Contributor

Choose a reason for hiding this comment

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

originalTagCache -> tagCache

<Callout>
The withFilter option is a specialized configuration that enhances your tagCache by layering an additional filter. It requires another tag cache to be passed in as the originalTagCache (e.g., `d1NextTagCache`, `doShardedTagCache` or your own).
</Callout>
This enhanced tag cache selectively filters which tags trigger revalidations, allowing you to focus on a specific subset and reduce unnecessary load on the underlying tag cache. For convenience, we provide the ready-to-use softTagFilter that automatically filters out tags used within the `revalidatePath` function. Using this filter will break the `revalidatePath` function.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This enhanced tag cache selectively filters which tags trigger revalidations, allowing you to focus on a specific subset and reduce unnecessary load on the underlying tag cache. For convenience, we provide the ready-to-use softTagFilter that automatically filters out tags used within the `revalidatePath` function. Using this filter will break the `revalidatePath` function.
This enhanced tag cache selectively filters which tags trigger revalidations, allowing you to focus on a specific subset and reduce unnecessary load on the underlying tag cache. For convenience, we provide the ready-to-use `softTagFilter` that automatically filters out tags used by the `revalidatePath` function making it a no-op.

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

LGTM with a couple nits

@vicb
Copy link
Contributor

vicb commented Apr 28, 2025

Is the primarily use case to filter soft tags or do you have another use case in mind?
It might be good to add it to the doc?

@conico974
Copy link
Contributor Author

Is the primarily use case to filter soft tags or do you have another use case in mind?
It might be good to add it to the doc?

It's mostly to filter out soft tags (but not necessarily all of them).
The only other reasons would be to filter tags that would have been set by some libs that are used by the user, but it may break the lib itself.
I don't see other reason to filter out tags, they are defined by the user, if they don't want them they should just not add them in the first place.

@conico974
Copy link
Contributor Author

@vicb I've added a line explaining the main purpose if you'd want to take a look

@vicb
Copy link
Contributor

vicb commented Apr 28, 2025

@vicb I've added a line explaining the main purpose if you'd want to take a look

Great, thanks!

@vicb vicb merged commit d7566e4 into opennextjs:main Apr 28, 2025
1 check passed
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.

3 participants