## Description
TL;DR
For list widget's child widget, when events like `onClick` were defined
using the action selector, it throws syntax error.
Reason:
Underneath the hood the new action selector by default applies a
semi-colon (`;`) at the end of every action selected. This does not play
well with the List v2 as the widget adds a wrapper on top of this action
which leads to a syntax error.
Fix:
For trigger paths the binding is ow enclosed with `{ }`
where as the binding paths are not enclosed with `{ }`
Example
```js
(() => { showAlert("Hello") })() // For trigger paths
(() => currentItem.name )() // For binding paths
```
It is expected for binding paths to return a value from the binding so
to make it return by default js binding cannot be wrapped around `{ }`.
In case of trigger paths, it is not expected for the js binding to
return anything but only execute other actions. When wrapped around `{
}`, it gives an advantage when action selectors are used to define a
trigger/event. Action selectors by default adds a semi-colon(;) at the
end of every action. If the wrapper `{}` is not present then a binding
```
(() => showAlert("Hello"); )()
```
would throw an error as the addition of a semi-colon is an invalid
JavaScript syntax.
Hence we convert the above IIFE to
```
(() => { showAlert("Hello"); } )()
```
to make the semi-colon work.
Fixes#22373
## Type of change
- Bug fix (non-breaking change which fixes an issue)
## How Has This Been Tested?
- Cypress
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [x] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [x] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Rimil Dey <rimil@appsmith.com>