Repository navigation
fix(router): treat /application as outside base="/app" - #572
Conversation
Target ES2022, require React 18.2 and TypeScript 5.2, and retain Preact 10 support. Remove obsolete compatibility code, fix optional parameter caching, and improve route and navigation declarations. Add framework and type compatibility matrices, SSR coverage, and dependency-inclusive size measurements. Verified runtime tests, all supported React versions, strict type consumers, lint, formatting, package exports, and bundle limits.
|
|
|
Thanks, the fix is correct and brings One request before merging: drop the return !base ||
(path.toLowerCase() + "/").startsWith(base.toLowerCase() + "/")
? path.slice(base.length) || "/"
: "~" + path;Then flip the existing expectation to Generated by Claude Code |
|
Hey @damiengrandi thank you for your PR. sorry for the AI-generated reply, I just asked Claude to review it. And I think it's a good point and we should drop that check. Could you please update it? I'd be happy to merge this once this fix lands. Alexey. |
|
Hi @molefrog, it's done! |
|
Published in v3.11.1 |
Description
Routerwithbase="/app"treated/applicationas in-base (lication) becauserelativePathused a string prefix (indexOf === 0), not a path segment.It now matches only when the path is the base, or continues with
//%2F(decodeURIleaves%2Fencoded, so/app%2Fusersstill yields%2Fusers).To reproduce
Save as
repro.mjsat the repo root, then run without this PR:node repro.mjs2/4 fail
To test the fix
bun test packages/wouter/test/path-normalization.test.tsxnode repro.mjsagain: no failScreenshots
bun test after the fix: