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 ignore querystring from useSection href prop #891

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

igorbrasileiro
Copy link
Contributor

@igorbrasileiro igorbrasileiro commented Mar 11, 2025

Description

The idea of this is allow websites that uses useSection to ignore some querystrings from useSection cache key, resulting in a stable cache key with better cache hit ratio.

Consideration

This api unstable_blockUseSectionHrefQueryStrings can be used in two ways:

  1. hardcoded blocked strings
// apps/site.ts
import { unstable_blockUseSectionHrefQueryStrings } from "deco/hooks"
unstable_blockUseSectionHrefQueryStrings(["utm_source", "gclid"])
  1. editable by CMS
// apps/site.ts
import { unstable_blockUseSectionHrefQueryStrings } from "deco/hooks"

interface SiteProps {
  // ... other Props
  blockedQs: string[]
}

export default function App({blockedQs}: Props) {
  // ... some code
  unstable_blockUseSectionHrefQueryStrings(blockedQs);
  // ... some code
}

Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 1.110.5 update
  • 🎉 for Minor 1.111.0 update
  • 🚀 for Major 2.0.0 update

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.

1 participant