From 4201a2e87bbcfd45434e90e54034830ecfccc2c8 Mon Sep 17 00:00:00 2001 From: Edward Simpson Date: Thu, 30 Jan 2020 11:23:56 +0000 Subject: [PATCH] Updating transformHit to fix broken autocomplete Updating js/algoliasearch/internals/frontend/common.js to short circuit hit._highlightResult in the window.transformHit function This is to fix an issue experienced where the Autocomplete dropdown stops showing products because this property is null --- js/algoliasearch/internals/frontend/common.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/algoliasearch/internals/frontend/common.js b/js/algoliasearch/internals/frontend/common.js index 7cc5acf0..3548ea37 100644 --- a/js/algoliasearch/internals/frontend/common.js +++ b/js/algoliasearch/internals/frontend/common.js @@ -60,6 +60,8 @@ document.addEventListener("DOMContentLoaded", function (e) { }; window.transformHit = function (hit, price_key, helper) { + hit._highlightResult = hit._highlightResult || {}; + if (Array.isArray(hit.categories)) { hit.categories = hit.categories.join(', '); } @@ -539,4 +541,4 @@ document.addEventListener("DOMContentLoaded", function (e) { window.scrollTo(x, y); }; }); -}); \ No newline at end of file +});