stencil-community / stencil-router

A simple router for Stencil apps and sites

Home Page:https://stenciljs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Path parameter values will be converted to lowercase

thedustin opened this issue · comments

Stencil version:

my-project@0.0.1
├── @stencil/core@2.13.0
├─┬ @stencil/store@2.0.1
│ └── @stencil/core@2.13.0 deduped
└─┬ stencil-router-v2@0.6.0
  ├── @stencil/core@2.13.0 deduped
  └─┬ @stencil/store@1.5.0
    └── @stencil/core@2.13.0 deduped

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request

Current behavior:

Using the router with path parameters will make the router pass all parameter values in lowercase to the route/render function.

Expected behavior:

Parameters should be passed without any modifications to the route.

Steps to reproduce:

  1. Create a Router, and add a match-Route with a path parameter
  2. Open the route in a web browser with a parameter like 1Bs9hcV5usFhyVJuqaNP3Q (the Base58 version of an ULID)
  3. The value in the console will be 1bs9hcv5usfhyvjuqanp3q

Related code:

<Router.Switch>
  <Route path={match("/users/:id")} render={({id}) =>
    [console.dir(id)]
  }></Route>
</Router.Switch>

Other information:

The issue seems to be the "normalization" of the path in the router, but I'm not that familiar with the code, and are not sure what happens if the normalization would just be removed.

const params = matchPath(normalizePathname(testUrl), route.path);