From 90265aec2472b531b53d6d0052c898799ee5a48b Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 30 Aug 2018 14:36:05 +0530 Subject: [PATCH] fix: Page container routing --- erpnext/public/js/hub/PageContainer.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/public/js/hub/PageContainer.vue b/erpnext/public/js/hub/PageContainer.vue index f213a180b6..ab270b93e0 100644 --- a/erpnext/public/js/hub/PageContainer.vue +++ b/erpnext/public/js/hub/PageContainer.vue @@ -58,7 +58,6 @@ export default { get_current_page() { const curr_route = frappe.get_route_str(); let route = Object.keys(route_map).filter(route => route == curr_route)[0]; - if (!route) { // find route by matching it with dynamic part const curr_route_parts = curr_route.split('/'); @@ -70,7 +69,7 @@ export default { let weight = 0; route_parts.forEach((part, i) => { const curr_route_part = curr_route_parts[i]; - if (part === curr_route_part || curr_route_part.includes(':')) { + if (part === curr_route_part || part.includes(':')) { weight += 1; } }); @@ -80,12 +79,13 @@ export default { }, {}); // get the route with the highest weight - let weight = 0 for (let key in weighted_routes) { const route_weight = weighted_routes[key]; - if (route_weight > weight) { + if (route_weight === curr_route_parts.length) { route = key; - weight = route_weight; + break; + } else { + route = null; } } }