From fd51e3e482c704cd283456f81ab8e7ba51453dd7 Mon Sep 17 00:00:00 2001 From: Rolando Henry Date: Thu, 21 Jun 2018 20:11:54 -0400 Subject: [PATCH] fix: No name on parent routes (#101) Fixes #98 --- src/helpers/routes.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/helpers/routes.js b/src/helpers/routes.js index c3950f4db..42a6df565 100644 --- a/src/helpers/routes.js +++ b/src/helpers/routes.js @@ -61,9 +61,13 @@ export const makeRoutes = (baseRoutes, { console.warn(`[${MODULE_NAME}] Can't generate localized route for route '${name}' with locale '${locale}' because locale is not in the module's configuration`) continue } + + // Make localized route name + localizedRoute.name = name + routesNameSeparator + locale // Generate localized children routes if any if (route.children) { + delete localizedRoute.name localizedRoute.children = [] for (let i = 0, length1 = route.children.length; i < length1; i++) { localizedRoute.children = localizedRoute.children.concat(buildLocalizedRoutes(route.children[i], { locales: [locale] }, true)) @@ -75,9 +79,6 @@ export const makeRoutes = (baseRoutes, { path = componentOptions.paths[locale] } - // Make localized route name - localizedRoute.name = name + routesNameSeparator + locale - // Add route prefix if needed const shouldAddPrefix = ( // No prefix if app uses different locale domains