@sledge-app/react-instant-search 2.0.64 → 2.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -708,7 +708,7 @@ const getSortMap = ({
708
708
  collectionAllId = ""
709
709
  }) => {
710
710
  activeCollectionId = activeCollectionId || "default";
711
- collectionAllId = collectionAllId || "all";
711
+ collectionAllId = collectionAllId || activeCollectionId || "all";
712
712
  return {
713
713
  "best-selling": `bestSellingSort.${collectionAllId}:asc`,
714
714
  "manual": `featuredSort.${activeCollectionId}:asc`,
@@ -10768,6 +10768,17 @@ const ResultProduct = React__default.memo((props) => {
10768
10768
  ...props2
10769
10769
  });
10770
10770
  };
10771
+ React__default.useEffect(() => {
10772
+ const handlePopState = () => {
10773
+ const params2 = new URLSearchParams(window.location.search);
10774
+ const page = Number(params2.get("page")) || 1;
10775
+ const validPage = Math.max(1, Math.floor(page));
10776
+ setCurrentPage(validPage);
10777
+ setIsReplaceWidgetList == null ? void 0 : setIsReplaceWidgetList(true);
10778
+ };
10779
+ window.addEventListener("popstate", handlePopState);
10780
+ return () => window.removeEventListener("popstate", handlePopState);
10781
+ }, []);
10771
10782
  const handlePageChange = (page) => {
10772
10783
  const searchParams2 = new URLSearchParams(document.location.search);
10773
10784
  searchParams2.set(queryPage, String(page));
@@ -10781,7 +10792,7 @@ const ResultProduct = React__default.memo((props) => {
10781
10792
  });
10782
10793
  }, 200);
10783
10794
  if (!objectPresent(previewSettings))
10784
- window.history.replaceState(null, "", `${document.location.pathname}?${searchParams2.toString()}`);
10795
+ window.history.pushState(null, "", `${document.location.pathname}?${searchParams2.toString()}`);
10785
10796
  };
10786
10797
  React__default.useEffect(() => {
10787
10798
  var _a2, _b2, _c2, _d2;