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

Duplicate route names with prefix_and_default strategy and nuxt-child #292

Closed
aldarund opened this issue May 7, 2019 · 3 comments
Closed

Comments

@aldarund
Copy link

aldarund commented May 7, 2019

Version

5.12.0

Reproduction link

https://codesandbox.io/s/q3lyoq6vkq

Steps to reproduce

Structure is following:

pages
  account
     child.vue
  account.vue

account.vue content

<template>
  <nuxt-child/>
</template>

What is expected ?

no duplicate children route generated

What is actually happening?

duplicate children route generated

11:00:57  WARN  [vue-router] Duplicate named routes definition: { name: "account-child___en-us___default", path: "/en-us/account/child" }


11:00:57  WARN  [vue-router] Duplicate named routes definition: { name: "account-child___en-us", path: "/en-us/account/child" }

Additional comments?

Related #140

This bug report is available on Nuxt community (#c235)
@rchl
Copy link
Collaborator

rchl commented May 7, 2019

Relevant generated routes:

    {
      path: "/account",
      component: _2479bbc0,
      name: "undefined___default",
      children: [{
        path: "child",
        component: _8329b026,
        name: "account-child___en-us___default"
      }, {
        path: "child",
        component: _8329b026,
        name: "account-child___en-us"
      }]
    }, {
      path: "/en-us/account",
      component: _2479bbc0,
      children: [{
        path: "child",
        component: _8329b026,
        name: "account-child___en-us___default"
      }, {
        path: "child",
        component: _8329b026,
        name: "account-child___en-us"
      }]
    }, {
      path: "/fr/account",
      component: _2479bbc0,
      children: [{
        path: "child",
        component: _8329b026,
        name: "account-child___fr"
      }]
    }

Problems:

  • there are two children per locale route (should be just one)
  • the undefined in /account route also looks wrong

@aldarund
Copy link
Author

aldarund commented May 7, 2019

undefined goes from or maybe some other similar place, didnt digged fully https://github.com/nuxt-community/nuxt-i18n/blob/dc668952c4501c2e0b95603dd838b47ec18db0b9/src/plugins/routing.js#L28
e.g. name is not undefined and it appends prefix to it and hence the undefiend__default

@rchl
Copy link
Collaborator

rchl commented May 7, 2019

Yes, looks like routes with children are not supposed to have name because one is not supposed to navigate to such routes directly.

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