-
Notifications
You must be signed in to change notification settings - Fork 41
Description
👋 Hello @jorgegorka
We found an issue which seems to be affecting only nested routes whose first path is a named param. For example
{
name: '/admin',
onlyIf: { guard: userIsAdminGuard, redirect: '/login' },
nestedRoutes: [
{
name: 'entity',
nestedRoutes: [
{ name: 'index', component: Admin },
{ name: ':entityId/details', component: Details },
],
},
],
},When trying to get /admin/entity/s0M3-iD/details the router would incorrectly case that to /admin/entity/s0m3-id/details which then fails to get the entity from the server due to case sensitive ids being used in the database.
By looking at the source code, it seems that this function could be the root cause. In a nested route context, the first part of the pathname could indeed be the named param.
From a naive perspective it seems unnecessary that a router library would make assumptions on the URL casing in any context, and just removing that .toLowerCase makes sense conceptually. Other approach could be to understand if this is a nested route and catch that separately.
Any thoughts on this? Happy to see this through into a PR once we land on a solution path.
Thanks :)