Reserve the locale param, carry it on breadcrumbs, translate the permissions detail view
CI / full-gate (push) Successful in 2m38s
CI / full-gate (push) Successful in 2m38s
This commit is contained in:
@@ -51,3 +51,8 @@ test("parseListQuery honours custom reserved names and page-size bounds", () =>
|
||||
assert.equal(parseListQuery("?n=999", { maxPageSize: 50, pageSizeParam: "n" }).pageSize, 50);
|
||||
assert.deepEqual(parseListQuery("?q=hi", { qParam: "search" }).filters, { q: ["hi"] });
|
||||
});
|
||||
|
||||
test("`locale` is the host's, not a filter — every localized list link carries it", () => {
|
||||
const query = parseListQuery("/admin/users?locale=sv-SE&status=active");
|
||||
assert.deepEqual(Object.keys(query.filters), ["status"]);
|
||||
});
|
||||
|
||||
@@ -31,7 +31,9 @@ export function parseListQuery(url: URL | URLSearchParams | string, options: Lis
|
||||
const sortParam = options.sortParam ?? "sort";
|
||||
const pageParam = options.pageParam ?? "page";
|
||||
const pageSizeParam = options.pageSizeParam ?? "pageSize";
|
||||
const reserved = new Set([pageParam, pageSizeParam, qParam, sortParam]);
|
||||
// `locale` is host-owned (README → Languages): every list link and both GET forms carry it, so
|
||||
// without this it would arrive as a phantom filter on every localized list page.
|
||||
const reserved = new Set([pageParam, pageSizeParam, qParam, sortParam, "locale"]);
|
||||
|
||||
const filters: Record<string, string[]> = {};
|
||||
for (const key of new Set(params.keys())) {
|
||||
|
||||
Reference in New Issue
Block a user