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 location = useLocation();
|
||||
const prevLocation = usePrevious(location);
|
||||
|
||||
// when the filter changes, update the URL
|
||||
const updateFilter = useCallback(
|
||||
@@ -47,7 +48,8 @@ export function useFilterURL(
|
||||
// and updates the filter accordingly.
|
||||
useEffect(() => {
|
||||
// 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
|
||||
if (!location.search) {
|
||||
@@ -73,7 +75,8 @@ export function useFilterURL(
|
||||
});
|
||||
}, [
|
||||
active,
|
||||
location.search,
|
||||
prevLocation,
|
||||
location,
|
||||
defaultFilter,
|
||||
setFilter,
|
||||
updateFilter,
|
||||
|
||||
Reference in New Issue
Block a user