Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions e2e/create-pages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ for (const mode of ['DEV', 'PRD'] as const) {
).toBeVisible();
});

test("nested/cat's pajamas", async ({ page }) => {
await page.goto(`http://localhost:${port}/nested/cat's%20pajamas`);
await expect(
page.getByRole('heading', { name: "Dynamic: cat's pajamas" }),
).toBeVisible();
});

test('jump', async ({ page }) => {
await page.goto(`http://localhost:${port}`);
await page.click("a[href='/foo']");
Expand Down
2 changes: 1 addition & 1 deletion packages/waku/src/router/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class CustomErrorHandler extends Component<
}
}

const getRouteSlotId = (path: string) => 'route:' + path;
const getRouteSlotId = (path: string) => 'route:' + decodeURIComponent(path);

const handleScroll = () => {
const { hash } = window.location;
Expand Down
5 changes: 3 additions & 2 deletions packages/waku/src/router/define-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,12 @@ export function unstable_defineRouter(fns: {
if (!pathConfigItem.specs.rootElementIsStatic || !skipIdSet.has('root')) {
entries.root = rootElement;
}
const routeId = ROUTE_SLOT_ID_PREFIX + pathname;
const decodedPathname = decodeURIComponent(pathname);
const routeId = ROUTE_SLOT_ID_PREFIX + decodedPathname;
if (!pathConfigItem.specs.routeElementIsStatic || !skipIdSet.has(routeId)) {
entries[routeId] = routeElement;
}
entries[ROUTE_ID] = [pathname, query];
entries[ROUTE_ID] = [decodedPathname, query];
entries[IS_STATIC_ID] = !!pathConfigItem.specs.isStatic;
if (await has404()) {
entries[HAS404_ID] = true;
Expand Down
Loading