Skip to content

EspoCRM – Open Source CRM Application

prevent action handler fired twice

Yuri Kuznetsovdf2f857197d1
diff --git a/client/src/utils.js b/client/src/utils.js
index c9a3cef3d3..0f33f7249d 100644
--- a/client/src/utils.js
+++ b/client/src/utils.js
@@ -121,6 +121,11 @@ Espo.Utils = {
});
}
else if (typeof view[method] === 'function') {
+ if (view?.events[`click [data-action="${action}"]`]) {
+ // Prevents from firing if a handler is already assigned. Important.
+ return false;
+ }
+
view[method].call(view, data, event);
event.preventDefault();