Skip to content

Commit 08a8747

Browse files
samoussbobylito
authored andcommitted
feat(wrapWithHits): enable async init (#2635)
1 parent 505552a commit 08a8747

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

dev/app/utils/wrap-with-hits.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,15 @@ export const wrapWithHits = (
7878
})
7979
);
8080

81-
initWidget(window.document.getElementById('widget-display'));
81+
if (initWidget.length === 1) {
82+
initWidget(window.document.getElementById('widget-display'));
8283

83-
window.search.start();
84+
return window.search.start();
85+
}
86+
87+
return initWidget(window.document.getElementById('widget-display'), () => {
88+
window.search.start();
89+
});
8490
};
8591

8692
export const wrapWithHitsAndJquery = fn =>

0 commit comments

Comments
 (0)