0

I'm using sitecore 9.1.1 and SXA 1.8.1.

I have a page on which i added the following components: 1- search result 2- search box with suggestion mode "show search result as prediction" 3- Date Filter 4- page selector

The problem is: when i search with a query in the search box such that the returned search result count is less than the pagesize of the search result, the API request gets called forever ( i get infinite API requests in the Network).

However if the result count is equal to or greater than the pagesize, the API gets called once and everything goes normal.

When i tried to debug "component-seacrh-page-selector" i found that the case where result count < pagesize is causing this problem because it has a timeout function in which it keeps updating the hashobj thus calling the search API again and again forever.

Mentioning that: if the datefilter has any value, the problem of infinite API requests no longer happens.

enter image description here

Any idea what might be the reason for this strange behaviour?

1
  • This issue has already been fixed in SXA 1.9. If I will find some time tomorrow I will try to find the fix and describe it here. As far as I remember 2/3 JS files was updated. Commented Jun 24, 2019 at 16:36

1 Answer 1

1

Like I've already mentioned in the comment - that is known the issue. It is already fixed in the SXA 1.9.

You can try to update the script on your side. Please change the setTimeout() function to something like that:

setTimeout(function () {
    hashObj = queryModel.parseHashParameters(window.location.hash);
    param = data.searchResultsSignature !== "" ? data.searchResultsSignature + "_e" : "e";
    if (hash[param] !== "0") {
        hashObj[param] = 0;
        Backbone.history.navigate(that.createFirstPageUrlHash(hashObj), { trigger: true, replace: true });
    }
}, 100);

Also, add param parameter to the var statement which is on the beginning of handleLoadedData() function.

1
  • 1
    Thank you so much, this solved the issue at my side. It's now working as expected.
    – AME
    Commented Jun 25, 2019 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.