preserve search query in overlay state hook (#15334)

This commit is contained in:
Josh Hawkins 2024-12-04 06:14:53 -06:00 committed by GitHub
parent 4dddc53735
commit a729408599
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,10 @@ export function useOverlayState<S>(
(value: S, replace: boolean = false) => {
const newLocationState = { ...currentLocationState };
newLocationState[key] = value;
navigate(location.pathname, { state: newLocationState, replace });
navigate(location.pathname + location.search, {
state: newLocationState,
replace,
});
},
// we know that these deps are correct
// eslint-disable-next-line react-hooks/exhaustive-deps