Skip to content

Commit

Permalink
fix: setup wizard recursion in routing (#21101) (#21102) (#21103)
Browse files Browse the repository at this point in the history
- setup wizard shows slide from index in route
- if you visit `/app/setup-wizard` then index in route is `undefined`
- because of hacky code we do `id + ''` so `undefined` becomes `"undefined"` a truthy value

The recursion of undefined > 0 > undefined > 0 continues until browser
intervenes and stops further routing.

(cherry picked from commit 4ab98b9)

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 6c3026f)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
mergify[bot] committed May 24, 2023
1 parent dfd0491 commit af236ef
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions frappe/desk/page/setup_wizard/setup_wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,14 @@ frappe.pages["setup-wizard"].on_page_load = function (wrapper) {
};
frappe.wizard = new frappe.setup.SetupWizard(wizard_settings);
frappe.setup.run_event("after_load");
let route = frappe.get_route();
if (route) {
frappe.wizard.show_slide(route[1]);
}
frappe.wizard.show_slide(cint(frappe.get_route()[1]));
},
});
});
};

frappe.pages["setup-wizard"].on_page_show = function () {
if (frappe.get_route()[1]) {
frappe.wizard && frappe.wizard.show_slide(frappe.get_route()[1]);
}
frappe.wizard && frappe.wizard.show_slide(cint(frappe.get_route()[1]));
};

frappe.setup.on("before_load", function () {
Expand Down Expand Up @@ -125,7 +120,7 @@ frappe.setup.SetupWizard = class SetupWizard extends frappe.ui.Slides {
return;
}
super.show_slide(id);
frappe.set_route(this.page_name, id + "");
frappe.set_route(this.page_name, cstr(id));
}

show_hide_prev_next(id) {
Expand Down

0 comments on commit af236ef

Please sign in to comment.