kitbagjs / router

A type safe router for vuejs
https://router.kitbag.dev
MIT License
173 stars 4 forks source link

route match not working for kebab param names #144

Closed stackoverfloweth closed 4 months ago

stackoverfloweth commented 5 months ago

url: http://localhost:5173/walk/zoo

routes

{
    name: 'walk', 
    path: '/walk', 
    component: () => import('../views/Walk.vue'),
    children: createRoutes([
      {
        name: 'walk-my-dogs', 
        path: '/:my-Param',
        component: () => import('../views/DogsList.vue')
      },
      {
        name: 'walk-shelter-dogs', 
        path: 'shelter-dogs',
        component: () => import('../views/DogsList.vue'),
        meta: {
          showShelterDogs: true
        }
      }
    ])
  },

if I change path on walk-my-dogs to

path: '/myParam'

it works fine

kktos commented 4 months ago

At first glance, it doesn't seem a problem, from my point of view. I mean, the param name is a variable name at the end, right ? so it should comply to the same js rules we have for a variable name, don't you think ?

stackoverfloweth commented 4 months ago

At first glance, it doesn't seem a problem, from my point of view. I mean, the param name is a variable name at the end, right ? so it should comply to the same js rules we have for a variable name, don't you think ?

I agree that's it's not a high priority problem but devs coming from vue-router will assume it works this way and it should be relatively easy to convert kebab-case param names into camelCase variable names

pleek91 commented 4 months ago

Prob fine if we said they had to be camel case. But I agree it be nice if it just worked either way and wasn't opinionated.

Best case the variable is the same as they defined it. Idk that we should do any conversions on it.