Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ismail-codar opened this issue Dec 8, 2016 · 1 comment
Closed

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

ismail-codar opened this issue Dec 8, 2016 · 1 comment

Comments

@ismail-codar
Copy link

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')
    })
  })
})
@ismail-codar ismail-codar changed the title Route names must be unique error! But it is different leaf. Route names must be unique error! But different leaf nodes. Dec 8, 2016
@KidkArolis
Copy link
Contributor

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' })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants