details:   https://code.tryton.org/tryton/commit/28bd871be2f0
branch:    7.0
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
        (grafted from 1aad63cbbba72af487eddba703c136c9b8e83060)
diffstat:

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

diffs (46 lines):

diff -r 7a259ea01f1f -r 28bd871be2f0 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
@@ -231,11 +231,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;
         },
@@ -283,19 +286,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