Skip to content

EspoCRM – Open Source CRM Application

Menu: Action handler in data revert support

Yurii264a77c09711
diff --git a/client/src/utils.ts b/client/src/utils.ts
index 1620c340af..50d7d46bdf 100644
--- a/client/src/utils.ts
+++ b/client/src/utils.ts
@@ -184,6 +184,7 @@ const Utils = {
method = 'action' + Utils.upperCaseFirst(action);
}
+ // @todo Drop `data.handler` support in v10.1.
handler = actionData.handler ?? handler ?? data.handler ?? null;
let fired = false;
diff --git a/client/src/views/main.ts b/client/src/views/main.ts
index ea737861ab..38698de024 100644
--- a/client/src/views/main.ts
+++ b/client/src/views/main.ts
@@ -270,12 +270,16 @@ class MainView<S extends MainViewSchema = MainViewSchema> extends View<S> {
itemList.forEach(item => {
const viewObject = this;
+ if (!item.hander && item.data?.handler) {
+ item.handler = item.data.handler;
+ }
+
// @todo Set _reRenderHeaderOnSync to true if `acl` is set `ascScope` is not set?
// Set _reRenderHeaderOnSync in `addMenuItem` method.
if (
(item.initFunction || item.checkVisibilityFunction) &&
- (item.handler || item.data && item.data.handler)
+ item.handler
) {
this.wait(new Promise(resolve => {
const handler = item.handler || item.data.handler;