v1.12.0
1.12.0 (2024-01-09)
Bug Fixes
Update trending-facets model types inherited from @algolia/recommend v4.22.0
https://github.com/algolia/algoliasearch-client-javascript/releases/tag/4.22.0
🤷 Why
The trending-facets API only returns type string for facetValue.
All other models return items/hits which are of type RecordWithObjectID
However trending-facets model returns a list of TrendingFacetHit which (by definition) don't have an objectID property.
To simplify the code, we can remove the type argument TObject for trending-facets
🔍 How to upgrade
If you're not using TypeScript, there is nothing to change. You can ignore the following.
If you're using TypeScript, and the trending-facets model, you should update your code like the following, by removing the type argument passed:
// The TrendingFacets React component usage goes from this:
type FacetHit = Hit<{
facetName: string;
facetValue: string;
}>
<TrendingFacets<FacetHit>
indexName="my-index"
// ...
// To this:
<TrendingFacets
indexName="my-index"
// ...
// or using hooks
const results = useTrendingFacets<FacetHit>(/* params */)
// becomes like this in v1.12.0
const results = useTrendingFacets(/* params */)If you're using @algolia/recommend-js you can remove the FacetHit type in a similar way:
trendingFacets<FacetHit>({
container: '#trendingFacets',
indexName,
// ...
// needs to be changed like this after v1.12.0:
trendingFacets({
container: '#trendingFacets',
indexName,
// ...If you encounter an issue with the upgrade, open an issue referencing this release.