Skip to content

Commit cd84e40

Browse files
committed
JS-6213 Initialize search lazily
1 parent 3b8782b commit cd84e40

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

static/js/com/search/search.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ $(document).ready(function () {
1414
$closeButton = $('.search-popup__close'),
1515
$layout = $('.global-layout');
1616

17+
let isInited = false;
1718

1819
const search = Instantsearch({
1920
appId: '7961PKYRXV',
@@ -58,11 +59,14 @@ $(document).ready(function () {
5859
})
5960
);
6061

61-
search.start();
62-
6362
const $input = $('.ais-search-box input');
6463

6564
function openPopup() {
65+
if (!isInited) {
66+
search.start();
67+
isInited = true;
68+
}
69+
6670
$searchPopup.removeClass('_hidden');
6771
$('body').addClass('_no-scroll');
6872
$('.ais-search-box--input').focus();

0 commit comments

Comments
 (0)