PromucFlow_constructor/app/client/src/widgets/ListWidgetV2
ashit-rath 27fe4d74e2
fix: List v2 child widgets event defined with action selector (#22418)
## 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>
2023-04-17 11:52:01 +05:30
..
component chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> 2023-03-16 17:11:47 +05:30
widget fix: clickable containers in the List widget (#21987) 2023-04-14 14:55:44 +01:00
constants.ts
icon.svg
index.ts chore: Move autocomplete suggestions from entityDefinitions to individual widget components (#21818) 2023-04-14 11:57:49 +05:30
MetaWidgetGenerator.test.ts chore: Move autocomplete suggestions from entityDefinitions to individual widget components (#21818) 2023-04-14 11:57:49 +05:30
MetaWidgetGenerator.ts fix: List v2 child widgets event defined with action selector (#22418) 2023-04-17 11:52:01 +05:30
Queue.test.ts chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> 2023-03-16 17:11:47 +05:30
Queue.ts
testData.ts feat: util to serve images locally or via remote url (#22080) 2023-04-10 12:32:31 +05:30