Quellcode durchsuchen

Fixed bug 614

bugfix/614
Djordje Mitrovic vor 3 Jahren
Ursprung
Commit
f29a43962d
2 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen
  1. 2
    1
      src/hooks/useOffers/useOffers.js
  2. 11
    2
      src/hooks/useOffers/useQueryString.js

+ 2
- 1
src/hooks/useOffers/useOffers.js Datei anzeigen

@@ -51,8 +51,9 @@ const useOffers = () => {
}, []);

useEffect(() => {
if (history.location.state?.logo) {
if (!queryStringHook.historyStateCleared) {
clearFiltersAndApply();
history.location.state = {};
}
}, [history.location]);


+ 11
- 2
src/hooks/useOffers/useQueryString.js Datei anzeigen

@@ -16,15 +16,23 @@ const useQueryString = () => {
const dispatch = useDispatch();
const [isInitiallyLoaded, setIsInitallyLoaded] = useState(false);
const [queryObject, setQueryObject] = useState({});
const [historyStateCleared, setHistoryStateCleared] = useState(true);

// Initially read filters, sorting and paging from querystring
useEffect(() => {
if ((!isInitiallyLoaded || history.location?.state?.logo) && !history.location?.state?.from) {
if (
(!isInitiallyLoaded || history.location?.state?.logo) &&
!history.location?.state?.from
) {
const queryStringFromUrl = history.location?.search;
setQueryObject(getQueryObjectHelper(queryStringFromUrl));
dispatch(setQueryString(queryStringFromUrl));
}
history.location.state = {}
if (history.location?.state?.logo) {
setHistoryStateCleared(false);
} else {
setHistoryStateCleared(true);
}
}, [history.location]);

// Set initially loaded to true on initial load
@@ -55,6 +63,7 @@ const useQueryString = () => {
queryString,
queryObject,
isInitiallyLoaded,
historyStateCleared,
};
};
export default useQueryString;

Laden…
Abbrechen
Speichern