feat(admin-ui): Encode location id in URL on location table (#3533)
Encoded the `location_id` into the query params and ensured it gets parsed on mount, into defaults. This allows safer refreshes of the locations table or accurate deep-links to be shared. Resolves CORE-1252
This commit is contained in:
@@ -25,7 +25,7 @@ interface InventoryFilterState {
|
||||
additionalFilters: InventoryDefaultFilters | null
|
||||
}
|
||||
|
||||
const allowedFilters = ["location", "q", "offset", "limit"]
|
||||
const allowedFilters = ["q", "offset", "limit", "location_id"]
|
||||
|
||||
const DefaultTabs = {}
|
||||
|
||||
@@ -226,8 +226,8 @@ export const useInventoryFilters = (
|
||||
if (value && typeof value === "string") {
|
||||
toQuery["q"] = value
|
||||
}
|
||||
} else if (key === "offset" || key === "limit") {
|
||||
toQuery[key] = value
|
||||
} else if (key === "offset" || key === "limit" || key === "location") {
|
||||
toQuery[stateFilterMap[key] || key] = value
|
||||
} else if (value.open) {
|
||||
toQuery[stateFilterMap[key]] = value.filter
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user