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.64k stars 3.74k forks source link

[Bug]: selectedItem of List Widget Not Reflecting Dynamically Update Value Immediately #25639

Open ame-appsmith opened 1 year ago

ame-appsmith commented 1 year ago

Is there an existing issue for this?

Description

In a List widget populated by a JS Object, if a property of the selectedItem changes dynamically (e.g., onClick of a button), the updated value id not getting reflected in the selectedItem until the user deselects it and selects it again (or selects another item, then selects it again). See this screen recording.

Steps To Reproduce

  1. Add a List widget to the canvas and populate it from a JS Object.
  2. Create a JS function that updates a property of one of the items (e.g., the first one).
  3. Run this JS function in the onClick event of a button.
  4. Add a Text widget and bind it to the respective property of the selectedItem of the list.
  5. Select the item, then click the button, and note that the value shown in the Text widget does not get updated unless re-selecting the item.

Public Sample App

https://app.appsmith.com/app/list-selecteditem-updated-dynamically/list-64be65fc4088450b8c5789d2

Environment

Production

Issue video log

https://www.loom.com/share/afe79d54db434c67bff38eb1d6160cd2

Version

v1.9.29

somangshu commented 1 year ago

This is expected @ame-appsmith. Appsmith does not support updates like these, as we dont evaluate or re-render the component. The same reason why we worked set meta property project.

@ashit-rath is this intended in list specifically or you think this is generic behaviour?

cc @dilippitchika @sbalaji1192

somangshu commented 1 year ago

Somewhat loosely explained here. Seems like this is intentional by design.