appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.2k stars 3.7k forks source link

[Bug]: Button group widget onClick doesn't work for buttons #12410

Closed dilippitchika closed 2 years ago

dilippitchika commented 2 years ago

Is there an existing issue for this?

Description

Button group widgets on click functionality doesn't work when a button is bound to onClick both in edit and view mode.

Steps To Reproduce

  1. Add a new button group widget
  2. Bind onClick property for the buttons in the button group
  3. Click the button to see that the action doesn't get executed

Public Sample App

No response

Version

Production

dilippitchika commented 2 years ago

Loom - LOOM DEMO

yaldram commented 2 years ago

@dilippitchika @techbhavin @sbalaji1192 I think the issue is in ButtonGroupWidget/components/index.tsx on line 543 remove the curry function -

// change this
onButtonClick = (onClick: string | undefined) => () => {
    this.props.buttonClickHandler(onClick);
  };
// to this remove the currying here
onButtonClick = (onClick: string | undefined) => {
    this.props.buttonClickHandler(onClick);
  };

Please also check the onClick for menu items after you remove the currying