fix: Page container routing
diff --git a/erpnext/public/js/hub/PageContainer.vue b/erpnext/public/js/hub/PageContainer.vue
index f213a18..ab270b9 100644
--- a/erpnext/public/js/hub/PageContainer.vue
+++ b/erpnext/public/js/hub/PageContainer.vue
@@ -58,7 +58,6 @@
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 @@
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 @@
}, {});
// 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;
}
}
}