mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Fix UI loop when sorting by random without seed (#6167)
This commit is contained in:
@@ -24,6 +24,7 @@ export function useFilterURL(
|
|||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const prevLocation = usePrevious(location);
|
||||||
|
|
||||||
// when the filter changes, update the URL
|
// when the filter changes, update the URL
|
||||||
const updateFilter = useCallback(
|
const updateFilter = useCallback(
|
||||||
@@ -47,7 +48,8 @@ export function useFilterURL(
|
|||||||
// and updates the filter accordingly.
|
// and updates the filter accordingly.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// don't apply if active is false
|
// don't apply if active is false
|
||||||
if (!active) return;
|
// also don't apply if location is unchanged
|
||||||
|
if (!active || prevLocation === location) return;
|
||||||
|
|
||||||
// re-init to load default filter on empty new query params
|
// re-init to load default filter on empty new query params
|
||||||
if (!location.search) {
|
if (!location.search) {
|
||||||
@@ -73,7 +75,8 @@ export function useFilterURL(
|
|||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
active,
|
active,
|
||||||
location.search,
|
prevLocation,
|
||||||
|
location,
|
||||||
defaultFilter,
|
defaultFilter,
|
||||||
setFilter,
|
setFilter,
|
||||||
updateFilter,
|
updateFilter,
|
||||||
|
|||||||
Reference in New Issue
Block a user