details:   https://code.tryton.org/tryton/commit/1aad63cbbba7
branch:    default
user:      Cédric Krier <[email protected]>
date:      Tue May 19 17:18:34 2026 +0200
description:
        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
diffstat:

 sao/src/wizard.js |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 9950ddea3804 -r 1aad63cbbba7 sao/src/wizard.js
--- a/sao/src/wizard.js Tue May 19 17:13:41 2026 +0200
+++ b/sao/src/wizard.js Tue May 19 17:18:34 2026 +0200
@@ -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;

Reply via email to