QubitProducts/cherrytree

Route names must be unique error! But different leaf nodes.

ismail-codar opened this issue · 1 comments

Following example raises: Error: Invariant Violation: Route names must be unique, but route "messages" is declared multiple times

But routes are can be like /messages and /profile/username/messages

router.map(function (route) {
  route('application', {path: '/', abstract: true}, function () {
    route('feed', {path: ''})
    route('messages')
    route('status', {path: ':user/status/:id'})
    route('profile', {path: ':user'}, function () {
      route('profile.lists')
      route('profile.edit'),
      route('messages')
    })
  })
})

That's right, route names must be unique so you could refer to the specific route, eg router.transitionTo('messages') needs to unambiguously transition to the right route.

In your example you could rename the inner messages to

route('profile.messages', { path: 'messages' })

Or

route('profileMessages', { path: 'messages' })