This commit is contained in:
ryan-crabbe-berri 2026-08-27 18:46:54 -05:00 committed by GitHub
commit c1963e7b2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -25,6 +25,11 @@ describe("createTabRoutes.slugFromPathname", () => {
it("returns empty string when the base segment is not in the path", () => {
expect(routes.slugFromPathname("/teams")).toBe("");
});
it("reads the route base after a server-root prefix that repeats the segment name", () => {
expect(routes.slugFromPathname("/logs/ui/logs/audit/")).toBe("audit");
expect(routes.slugFromPathname("/logs/ui/logs/")).toBe("");
});
});
describe("createTabRoutes.tabHref", () => {

View file

@ -15,7 +15,7 @@ export function createTabRoutes<Slug extends string>(baseSegment: string, slugs:
const slugFromPathname = (pathname: string): string => {
const parts = pathname.split("/").filter(Boolean);
const idx = parts.indexOf(baseSegment);
const idx = parts.lastIndexOf(baseSegment);
if (idx === -1) {
return "";
}