Merge pull request #7558 from Alchez/develop-route-history-issue

fix: Fix routing issue causing dynamic links to disappear
This commit is contained in:
Saurabh 2019-05-28 12:04:09 +05:30 committed by GitHub
commit 67e7af4bc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -185,7 +185,10 @@ frappe.ui.form.save = function (frm, action, callback, btn) {
throw "saving";
}
frappe.ui.form.remove_old_form_route();
// ensure we remove new docs routes ONLY
if ( frm.is_new() ) {
frappe.ui.form.remove_old_form_route();
}
frappe.ui.form.is_saving = true;
return frappe.call({
@ -224,14 +227,9 @@ frappe.ui.form.save = function (frm, action, callback, btn) {
}
frappe.ui.form.remove_old_form_route = () => {
let index = -1;
let current_route = frappe.get_route();
frappe.route_history.map((arr, i) => {
if (arr.join("/") === current_route.join("/")) {
index = i;
}
});
frappe.route_history.splice(index, 1);
let current_route = frappe.get_route().join("/");
frappe.route_history = frappe.route_history
.filter((route) => route.join("/") !== current_route);
}
frappe.ui.form.update_calling_link = (newdoc) => {