Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent multiple actions from executing #8031

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

shendriks-workgrid
Copy link

@shendriks-workgrid shendriks-workgrid commented Nov 9, 2022

Description

With the current code in adaptivecards-react, both submitAction and executeAction will be executed if both callbacks are passed and a submit action is triggered. This is unexpected behaviour.

This seems to be a bug that slipped in as indicated by the old comment and running executeAction in the switch/case same as the rest of the handlers solves the issue.

Sample App

import React from "react";
import { AdaptiveCard } from "adaptivecards-react";

const payload = {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.Execute",
                    "title": "Action.Execute"
                },
                {
                    "type": "Action.Submit",
                    "title": "Action.Submit"
                }
            ]
        }
    ]
}

const App = () => {
  // onExecute Handler
  const onExecuteAction = (e) => {
    console.log("Running ExecuteAction");
  };
  // onSubmit Handler
  const onActionSubmit = (e) => {
    console.log("Running onActionSubmit");
  };

  return <AdaptiveCard payload={payload} onExecuteAction={onExecuteAction} onActionSubmit={onActionSubmit}/>;
};

export default App;

Expected behaviour:

  • Clicking on Action.Execute should only execute the onExecuteAction
  • Clicking on Action.Submit should only execute the onActionSubmit

Actual behaviour:

  • Clicking on Action.Execute executes the onExecuteAction
  • Clicking on Action.Submit executes the onActionSubmit and onExecuteAction
Microsoft Reviewers: Open in CodeFlow

With the current code in `adaptivecards-react`, both submitAction and executeAction will be executed when a submit action is triggered. This is unexpected behaviour
@ghost
Copy link

ghost commented Nov 9, 2022

Hi @shendriks-workgrid. Thanks for helping make the AdaptiveCards JS renderer + tooling better. As additional verification, once the JS build succeeds, please go to the test site to test out your website/designer changes.

@ghost ghost added the no-recent-activity label Nov 15, 2022
@ghost
Copy link

ghost commented Nov 15, 2022

Hi @shendriks-workgrid. This pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

@ghost ghost removed the no-recent-activity label Nov 16, 2022
@ghost
Copy link

ghost commented Nov 16, 2022

Staleness reset by shendriks-workgrid

@ghost ghost added the no-recent-activity label Nov 21, 2022
@ghost
Copy link

ghost commented Nov 21, 2022

Hi @shendriks-workgrid. This pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

@ghost ghost removed the no-recent-activity label Nov 22, 2022
@ghost
Copy link

ghost commented Nov 22, 2022

Staleness reset by shendriks-workgrid

@ghost ghost added the no-recent-activity label Nov 27, 2022
@ghost
Copy link

ghost commented Nov 27, 2022

Hi @shendriks-workgrid. This pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

@ghost ghost removed the no-recent-activity label Dec 7, 2022
@ghost
Copy link

ghost commented Dec 7, 2022

Staleness reset by shendriks-workgrid

@errouthier
Copy link

errouthier commented Dec 9, 2022

Could we please have someone take a look at this?

@ghost ghost added the no-recent-activity label Dec 17, 2022
@ghost
Copy link

ghost commented Dec 17, 2022

Hi @shendriks-workgrid. This pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

@ghost ghost removed the no-recent-activity label Dec 20, 2022
@ghost
Copy link

ghost commented Dec 20, 2022

Staleness reset by shendriks-workgrid

@ghost ghost added the no-recent-activity label Dec 26, 2022
@ghost
Copy link

ghost commented Dec 26, 2022

Hi @shendriks-workgrid. This pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants