Fixing issue where useQuery would continually set the query.

This commit is contained in:
Roland 2024-03-12 16:47:50 -06:00
parent e4e0a1d722
commit d9f7ca273c
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93

View file

@ -136,12 +136,12 @@ export const useQuery = (defaultParams) => {
if (!_.isEmpty(state)) {
console.debug('Changing URL params', state);
}
}, [state]);
}, [JSON.stringify(state)]);
React.useEffect(() => {
// Keep URL and state in sync.
setState(getSearchParamCopy(searchParams));
}, [searchParams]);
}, [JSON.stringify(searchParams)]);
const updateQuery = (newParams, replace = false) => {
// Update the old state with the new values.