From f895a3df241b530b6db2379621d66c03e5d946f8 Mon Sep 17 00:00:00 2001 From: Stephan Hendriks <108012757+shendriks-workgrid@users.noreply.github.com> Date: Wed, 9 Nov 2022 16:57:38 +0000 Subject: [PATCH] Prevent multiple actions from executing With the current code in `adaptivecards-react`, both submitAction and executeAction will be executed when a submit action is triggered. This is unexpected behaviour --- .../nodejs/adaptivecards-react/src/adaptive-card.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/nodejs/adaptivecards-react/src/adaptive-card.tsx b/source/nodejs/adaptivecards-react/src/adaptive-card.tsx index fa617c7ceb..c279dc4609 100644 --- a/source/nodejs/adaptivecards-react/src/adaptive-card.tsx +++ b/source/nodejs/adaptivecards-react/src/adaptive-card.tsx @@ -97,11 +97,12 @@ export const AdaptiveCard = ({ } break; } - } - // TODO: Why is there a global action handler when we have specific - // handlers for the above cases? Can we simplify to one approach? - if (onExecuteAction) { - onExecuteAction(a); + case AdaptiveCards.ExecuteAction.JsonTypeName: { + if (onExecuteAction) { + onExecuteAction(a); + } + break; + } } }, [onActionOpenUrl, onActionShowCard, onActionSubmit, onExecuteAction]