From bf5328229ee8a7dc66579f5f5b62f0921d0955c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 19 May 2026 17:18:34 +0200 Subject: [PATCH] Process response to wizard button only if the state is still the same The response is asynchronous so when the event is processed the state may have changed. Closes #14847 (grafted from 1aad63cbbba72af487eddba703c136c9b8e83060) --HG-- branch : 8.0 --- sao/src/wizard.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sao/src/wizard.js b/sao/src/wizard.js index 03ae80c527..5a2971d45f 100644 --- a/sao/src/wizard.js +++ b/sao/src/wizard.js @@ -238,11 +238,14 @@ this.footer.empty(); }, _get_button: function(definition) { + let state = this.state; var button = Sao.Wizard.Form._super._get_button.call(this, definition); this.footer.append(button.el); button.el.click(() => { - this.response(definition); + if (this.state === state) { + this.response(definition); + } }); return button; }, @@ -290,19 +293,24 @@ this.footer.empty(); }, _get_button: function(definition) { + let state = this.state; var button = Sao.Wizard.Dialog._super._get_button.call(this, definition); this.footer.append(button.el); if (definition['default']) { this.content.unbind('submit'); this.content.submit(e => { - this.response(definition); e.preventDefault(); + if (this.state === state) { + this.response(definition); + } }); button.el.attr('type', 'submit'); } else { button.el.click(() => { - this.response(definition); + if (this.state === state) { + this.response(definition); + } }); } return button;