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

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.
@@ -2732,7 +2732,7 @@ const SearchResultWidget = (props) => {
2732
2732
  const [showOutOfStock, setShowOutOfStock] = React__default.useState((_i = sledgeSettings == null ? void 0 : sledgeSettings.instantsearch) == null ? void 0 : _i.show_out_of_stock);
2733
2733
  const [initStatesFirstTime, setInitStatesFirstTime] = React__default.useState(true);
2734
2734
  const searchResultContainerRef = React__default.useRef(null);
2735
- const previousState = usePrevious({ keyword, isRenderApp });
2735
+ const previousState = usePrevious({ keyword });
2736
2736
  const handleChangeTabIndex = (id, name, e) => {
2737
2737
  setClickedTabIndexId(id);
2738
2738
  setClickedTabIndexName(name);
@@ -2862,15 +2862,12 @@ const SearchResultWidget = (props) => {
2862
2862
  await handleInitStates(response, "totalDataPerIndex");
2863
2863
  };
2864
2864
  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
- }, []);
2865
+ if (!(isRenderApp == null ? void 0 : isRenderApp.instantSearch))
2866
+ return;
2867
+ const searchParams2 = new URLSearchParams(document.location.search);
2868
+ setKeyword((searchParams2 == null ? void 0 : searchParams2.get(queryKeyword)) || "");
2869
+ handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");
2870
+ }, [isRenderApp]);
2874
2871
  React__default.useEffect(() => {
2875
2872
  if (Boolean(previousState && (previousState == null ? void 0 : previousState.keyword) !== keyword) && layoutType === "default") {
2876
2873
  const INSTANT_SEARCH_SETTING = JSON.parse(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");