A Modern Marvel: Serving "Applied Filters" by Default with React & TypeScript for Sitecore Content Hub

Ahoy, digital voyagers! πŸš€ Ready to embark on a thrilling journey into the realm of React, TypeScript, and Sitecore Content Hub? Fasten your seatbelts, because today, we’re diving deep into the world of external components, and trust me, it's going to be a mouth-watering adventure.

The Backdrop: "Restaurant of Mistaken Orders"

Before we begin, let's set the stage with a metaphor. Have you ever dined at the "Restaurant of Mistaken Orders"? It's a unique place where servers intentionally mess up your order, all in the name of fun. But imagine if every time you visited, they remembered that you prefer your coffee with two sugars or that you despise pickles on your burger. They’d still make playful mistakes, but they'd never forget your most vital preferences. That's what we're aiming to achieve with our component: a delightful user experience that remembers your key choices.

The Culinary Delight: Why "Applied Filters"?

Just like a chef curates a menu tailored to the preferences of their patrons, digital platforms should cater to the unique tastes of their users. In the vast digital landscape of Sitecore Content Hub, users often find themselves sifting through a plethora of content. So, why not make life easier by serving them a plate of "Applied Filters" by default?


  1. Streamlined UX: Just as you wouldn't want to specify "no pickles" every single time you order, users don't want to set the same filters repeatedly.
  2. Efficiency: Time saved from repeatedly setting the same filters can be better spent on more critical tasks.
  3. Personalized Experience: Remembering user preferences creates a more tailored and enjoyable browsing journey.

The Recipe: A Deep Dive into the Code

Our main ingredient is the ApplySearchFilter component, a delightful concoction of React & TypeScript. This external component for Sitecore Content Hub is designed to apply search filters by default. Let's break down the recipe:


  • React & TypeScript: Our main building blocks.
  • Sitecore Content Hub SDK: The secret sauce that allows us to interact with the Content Hub.
  • State Management: Using useState to keep track of how many times we've attempted to apply the filters.

Cooking Instructions:

  • We begin by setting up an event listener for when a search finishes.
  • On detecting the event, our component checks if the search matches our criteria.
  • If it’s a match, voilΓ ! We apply our configured filters. But there's a twist: we ensure we don’t overdo it. Just like adding salt to a dish, after three attempts, we stop to prevent overwhelming the user.

Serving: Once our filters are applied, we provide feedback to the user, ensuring they're always in the know.

The Cherry on Top: Humor & Conclusion

Just like the playful servers at the "Restaurant of Mistaken Orders", our component brings a touch of humor to the otherwise serious world of digital content. By remembering user preferences and serving them "Applied Filters" by default, we enhance the user experience, ensuring that it's both efficient and delightful.

So, the next time you're sipping on that perfectly brewed coffee (with two sugars, of course) at the "Restaurant of Mistaken Orders", take a moment to appreciate the beauty of personalization. Whether it's in the culinary world or the digital realm, it's the little things that make all the difference.

Bon AppΓ©tit, and happy coding! πŸ”πŸš€πŸ‘©‍πŸ’»πŸ‘¨‍πŸ’»πŸŽ‰

πŸ”— Full code can be found here: ch-apply-search-filter on GitHub