Skip to content

Commit

Permalink
fix(menu): prevent error on stale search
Browse files Browse the repository at this point in the history
If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720
  • Loading branch information
Haroenv committed Jul 10, 2019
1 parent 0628776 commit f210b70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/connectors/menu/connectMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ export default function connectMenu(renderFn, unmountFn) {
},

render({ results, instantSearchInstance }) {
const facetValues = results.getFacetValues(attribute, { sortBy });
const facetItems =
results.getFacetValues(attribute, { sortBy }).data || [];
facetValues && facetValues.data ? facetValues.data : [];

const items = transformItems(
facetItems
.slice(0, this.getLimit())
Expand Down

0 comments on commit f210b70

Please sign in to comment.