@sledge-app/react-instant-search 0.0.85 → 0.0.87

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.
@@ -2699,6 +2699,7 @@ const SearchIconWidgetPopup = () => {
2699
2699
  const SearchResultWidget = (props) => {
2700
2700
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
2701
2701
  const { isRenderApp, isJsVersion } = React__default.useContext(SledgeContext);
2702
+ const { instantSearch: isRenderAppInstantSearch } = isRenderApp || {};
2702
2703
  const { layoutType = "default", query, params, children, onAfterAddToCart, onAfterAddWishlist, onAfterRemoveWishlist, onAfterRenderProduct, data: propsData, sledgeSettings } = props;
2703
2704
  const { keyword: queryKeyword = "" } = query || {};
2704
2705
  const { collectionId } = params || {};
@@ -2732,7 +2733,7 @@ const SearchResultWidget = (props) => {
2732
2733
  const [showOutOfStock, setShowOutOfStock] = React__default.useState((_i = sledgeSettings == null ? void 0 : sledgeSettings.instantsearch) == null ? void 0 : _i.show_out_of_stock);
2733
2734
  const [initStatesFirstTime, setInitStatesFirstTime] = React__default.useState(true);
2734
2735
  const searchResultContainerRef = React__default.useRef(null);
2735
- const previousState = usePrevious({ keyword, isRenderApp });
2736
+ const previousState = usePrevious({ keyword });
2736
2737
  const handleChangeTabIndex = (id, name, e) => {
2737
2738
  setClickedTabIndexId(id);
2738
2739
  setClickedTabIndexName(name);
@@ -2862,15 +2863,12 @@ const SearchResultWidget = (props) => {
2862
2863
  await handleInitStates(response, "totalDataPerIndex");
2863
2864
  };
2864
2865
  React__default.useEffect(() => {
2865
- console.log("useEffect running");
2866
- console.log("previousState", previousState);
2867
- setTimeout(() => {
2868
- const searchParams2 = new URLSearchParams(document.location.search);
2869
- setKeyword((searchParams2 == null ? void 0 : searchParams2.get(queryKeyword)) || "");
2870
- handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");
2871
- console.log("setTimeout");
2872
- }, 1500);
2873
- }, []);
2866
+ if (!isRenderAppInstantSearch)
2867
+ return;
2868
+ const searchParams2 = new URLSearchParams(document.location.search);
2869
+ setKeyword((searchParams2 == null ? void 0 : searchParams2.get(queryKeyword)) || "");
2870
+ handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");
2871
+ }, [isRenderAppInstantSearch]);
2874
2872
  React__default.useEffect(() => {
2875
2873
  if (Boolean(previousState && (previousState == null ? void 0 : previousState.keyword) !== keyword) && layoutType === "default") {
2876
2874
  const INSTANT_SEARCH_SETTING = JSON.parse(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");