Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Recursive routing for Form route #15539

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions frappe/public/js/frappe/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ frappe.router = {
resolve();
});
}, 100);
});
}).finally(() => frappe.route_flags = {});
},

get_route_from_arguments(route) {
Expand Down Expand Up @@ -374,8 +374,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