Skip to content

Commit

Permalink
fix(render-state): use renderstate and set explicit sortby (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhayab committed Jan 17, 2024
1 parent a5c98fe commit b726d2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions instantsearch.js/render-state/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ const emptyHits = connectHits(({ hits, widgetParams }) => {
return;
}

const refinementListsUiState = search.getUiState()[indexName].refinementList;
const brandState = search.renderState[indexName].refinementList.brand;
const isPearRefined =
refinementListsUiState &&
refinementListsUiState.brand &&
refinementListsUiState.brand.includes('Pear');
brandState.items.filter((item) => item.label === 'Pear' && item.isRefined)
.length > 0;

if (!isPearRefined) {
container.innerHTML = 'No results';
Expand Down Expand Up @@ -83,6 +82,7 @@ search.addWidgets([
})(refinementList)({
container: '#brand',
attribute: 'brand',
sortBy: ['isRefined'],
}),
panel({
templates: {
Expand Down

0 comments on commit b726d2f

Please sign in to comment.