This is a repo demonstrating a (potential) bug with Lit router.
- git clone https://github.com/keviddles/lit-routing-bug
- cd lit-routing-bug
- pnpm install
- pnpm start
- Navigate to localhost:5173
- Click on the link /some-path. Observe no text matching X-Child Blank Match. (It should appear).
- Click on the link /some-path/. Observe text matching X-Child Blank Match.
There are three components:
x-app
x-parent
x-child
x-app
defines a Router
and a match-all route ('/*'
).
x-parent
defines Routes
and defines a base ''
route, specific path route ('some-path/*?'
), and a fallback route. All routes appear to match correctly.
x-child
defines Routes
and defines a base ''
route, specific path route ('child/foo'
), and a fallback route. The base route does not seem to match; this may be a bug.
- In
x-parent
, this matches thepath: ''
route and rendersX-Parent Blank Match
. This seems correct.
- In
x-parent
, this matches the fallback route and rendersX-Parent Fallback Route
. This seems correct (as there is no matching route defined forfoo
inx-parent
).
- In
x-parent
, this matches thepath: 'some-path/*?'
route and renders anx-child
. - In
x-child
, this does not render anything. This seems wrong. I would expect it to match thepath: ''
route, or, failing that, fall back to the fallback route.
- In
x-parent
, this matches thepath: 'some-path/*?'
route and renders anx-child
. - In
x-child
, this matches thepath: ''
route and rendersX-Child Blank Match
. This seems correct.
- In
x-parent
, this matches thepath: 'some-path/*?'
route and renders anx-child
. - In
x-child
, this matches the fallback route and rendersX-Child Fallback Route
. This seems correct.
- In
x-parent
, this matches thepath: 'some-path/*?'
route and renders anx-child
. - In
x-child
, this matches thepath: 'child/foo'
route and rendersX-Child foo
. This seems correct.