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]: Irrelevant Error Message for Incorrect Options of Select Type Column in Table Widget #25825

Open ame-appsmith opened 1 year ago

ame-appsmith commented 1 year ago

Is there an existing issue for this?

Description

In a Table widget, when the user sets the Column type of a column to Select, then enters an incorrect value for Options (e.g., if there's a syntax error or duplicate values), an empty irrelevant error is displayed in both the Errors tab and the Options property, which is not helpful for debugging the issue.

image

image

We need to display a relevant error message to help users debug such kind of issues.

Steps To Reproduce

  1. Add a Table widget to the canvas and bind it to a query.
  2. In the Settings of one of the columns, set the Column type to Select.
  3. Enter some incorrect value for Options (e.g., do a syntax mistake/invalid JSON or enter duplicate values).
  4. Note the error displayed in the Errors tab and in the Options property of the column settings.

Public Sample App

https://app.appsmith.com/app/table-select-column-error/page1-64c4245e5ebbd221b60b42f1

Environment

Production

Issue video log

No response

Version

Appsmith v1.9.29

dilippitchika commented 1 year ago

@keyurparalkar please triage this, i assume this is happening because options is an array of arrays.

keyurparalkar commented 1 year ago

@dilippitchika irrespective of whether its array of arrays or not, we will still see this bug. I have triaged this and found out that the validation are working fine but the way we return the error message is incorrect inside the selectedOptions property's validation function.

Today we return the error message in the form of array of string, but the platform APIs expect the error message to be in the following format:

[
  {
    name: "<Error-type>",
    message: "Error message string"
  }
]

Solution: Update the validation function for this property to return the error message in the above format

somangshu commented 1 year ago

@keyurparalkar is this is problem in general. We might also need an RCA from a relevant team if this is miss in information flow. I.E. if the change was made without the dependency been taken care of, its a problem! On the contrary, could it be something we could have done better? 🤔

keyurparalkar commented 1 year ago

I think error handling change was handled in this PR but I think table widget was not included in the PR. @ChandanBalajiBP can you confirm?

keyurparalkar commented 1 year ago

@somangshu @ChandanBalajiBP has confirmed that this was missed out in the above PR.

somangshu commented 1 year ago

@keyurparalkar @ChandanBalajiBP what are the next steps here?