diff --git a/frappe/desk/page/user_profile/user_profile.js b/frappe/desk/page/user_profile/user_profile.js index 58d405479a..5f91b376e8 100644 --- a/frappe/desk/page/user_profile/user_profile.js +++ b/frappe/desk/page/user_profile/user_profile.js @@ -42,7 +42,7 @@ class UserProfile { } make_user_profile() { - frappe.set_route('user-profile', this.user_id); + frappe.set_route('user-profile', this.user_id, { redirect: true }); this.user = frappe.user_info(this.user_id); this.page.set_title(this.user.fullname); this.setup_user_search(); diff --git a/frappe/public/js/frappe/router.js b/frappe/public/js/frappe/router.js index f3f3285245..3c729f4af2 100644 --- a/frappe/public/js/frappe/router.js +++ b/frappe/public/js/frappe/router.js @@ -168,7 +168,14 @@ frappe.set_route = function() { } }).join('/'); - window.location.hash = route; + // Perform a redirect when redirect is set in route_options + if (frappe.route_options && frappe.route_options.redirect) { + const url = new URL(window.location); + url.hash = route; + window.location.replace(url); + } else { + window.location.hash = route; + } // Set favicon (app.js) frappe.provide('frappe.app');