DEV Community

Rob Earlam for Sitecore

Posted on • Originally published at robearlam.com on

Sitecore Search SDK - Breaking Change

Updating packages in Sitecore’s Developer Portal

Recently my colleague Mark van Aalst was updating the package versions for the Sitecore Developer Portal. This also included updating the version of the Sitecore Search React SDK from v2.0.0 to v2.2.2, among other packages that were updated at the same time. Once this had been deployed, we got reports that faceting was no longer working on the search results page. We quickly rolled back and started to look into what had happened.

Breaking changes in the Faceting UI component

I reached out to the team that owns the SDK and apparently there was a breaking change introduced in a previous version and we needed to update how we were leveraging the UI components being used to render the Search Results page.

Previously we were wrapping out Facets in the AccordionFacets.Root component, like so

<AccordionFacets.Root defaultFacetTypesExpandedList={facets.map((x) => x.name)} onFacetValueClick={onFacetClick}>
    ….
</AccordionFacets.Root>

Enter fullscreen mode Exit fullscreen mode

However, this approach is no longer valid, we should now be using SearchResultsAccordionFacets component instead. As follows:

<SearchResultsAccordionFacets defaultFacetTypesExpandedList={facets.map((x) => x.name)} onFacetValueClick={onFacetClick}>
    …
</SearchResultsAccordionFacets>

Enter fullscreen mode Exit fullscreen mode

This was a fairly straightforward change, which meant we could bump the Developer Portal up to be running on the latest version of the Search SDK 🎉.

To see the complete set of changes we had to make for the Developer Portal, you can view the PR that was opened for this fix here.

Top comments (0)