fix(dashboard): export with filters not working (#13711)

* fix(dashboard): export with filters not working

* page size

* own cr

* Create tiny-beans-poke.md
This commit is contained in:
William Bouchard
2025-10-09 08:00:06 -04:00
committed by GitHub
parent 2cfd0dfc6e
commit 82f3b0413a
5 changed files with 34 additions and 23 deletions

View File

@@ -4,6 +4,7 @@ import { Path, useLocation } from "react-router-dom"
/**
* Checks if the current location has a restore_params property.
* If it does, it will return a new path with the params added to it.
* Otherwise, it will check if the current location has search params and preserve them.
* Otherwise, it will return the previous path.
*
* This is useful if the modal needs to return to the original path, with
@@ -15,12 +16,17 @@ export const useStateAwareTo = (prev: string | Partial<Path>) => {
const to = useMemo(() => {
const params = location.state?.restore_params
if (!params) {
return prev
if (params) {
return `${prev}?${params.toString()}`
}
return `${prev}?${params.toString()}`
}, [location.state, prev])
// If no restore_params in state, check if the current URL has search params
if (location.search) {
return `${prev}${location.search}`
}
return prev
}, [location.state, location.search, prev])
return to
}