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.
š¤ What
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 ofTrendingFacetHit
which (by definition) don't have anobjectID
property.To simplify the code, we can remove the type argument
TObject
fortrending-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:If you're using
@algolia/recommend-js
you can remove theFacetHit
type in a similar way:If you encounter an issue with the upgrade, open an issue referencing this release.