Skip to content

Commit

Permalink
fix: Recursive routing for Form route (backport #15539) (#15648)
Browse files Browse the repository at this point in the history
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
Co-authored-by: Pruthvi Patel <pruthvipatel145@gmail.com>
  • Loading branch information
3 people committed Jan 18, 2022
1 parent 1f6ab8b commit 6df52d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frappe/public/js/frappe/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ frappe.router = {
resolve();
});
}, 100);
});
}).finally(() => frappe.route_flags = {});
},

get_route_from_arguments(route) {
Expand Down Expand Up @@ -353,8 +353,9 @@ frappe.router = {
// change the URL and call the router
if (window.location.pathname !== url) {

// push state so the browser looks fine
history.pushState(null, null, url);
// push/replace state so the browser looks fine
const method = frappe.route_flags.replace_route ? "replaceState" : "pushState";
history[method](null, null, url);

// now process the route
this.route();
Expand Down
1 change: 1 addition & 0 deletions frappe/public/js/frappe/views/formview.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ frappe.views.FormFactory = class FormFactory extends frappe.views.Factory {
if (new_name===name) {
this.render(doctype_layout, name);
} else {
frappe.route_flags.replace_route = true;
frappe.set_route("Form", doctype_layout, new_name);
}
}
Expand Down

0 comments on commit 6df52d5

Please sign in to comment.