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
33.9k stars 3.66k forks source link

[Bug]: Rating widget | Error message does not disappear unless hard refresh is done #17655

Open shadabbuchh opened 1 year ago

shadabbuchh commented 1 year ago

Is there an existing issue for this?

Description

Upon enabling the Allow Half Stars property, the error message that appears when the user enters a decimal value for Default Value does not disappear. However once we do a hard refresh, the error message disappears.

https://www.loom.com/share/92fc1e089d5145e4bba01941792818c8

Steps To Reproduce

  1. D&D a Rating widget.
  2. Enter a decimal value for Default Value property.
  3. Now enable the Allow Half Stars property.

Public Sample App

No response

Version

Cloud

SaiCharanChetpelly31 commented 3 months ago

HI @shadabbuchh @somangshu I can see similar issue in currency Widget. image

Steps to reproduce:

I can see similar issue in Checkbox group widget. image

For this type of issue, the error message is cleared when we change the input field.

May be appsmith team did it in this way for widgets.

I don't have clarity on how to proceed with this issue.

What are your thoughts on this?

SaiCharanChetpelly31 commented 3 months ago

@somangshu @Nikhil-Nandagopal @shadabbuchh The validation function is triggered when the user changes the input field. However, even though isAllowHalf is true, the validation function is not called, nor is the validation message cleared, when the user focuses on the input field. The validation message is only cleared when the user starts typing in the input field. I have checked other widgets and found no instance where the validation function is called on focus.

To address this, I plan to create a wrapper for the existing input field(new feature) to ensure the validation function is called when the input field is focused.

Please let me know if I am missing anything.

akshayvijayjain commented 2 months ago

@somangshu @Nikhil-Nandagopal @shadabbuchh

@SaiCharanChetpelly31 is working on this issue,

At present, we have explored how this validation is working in abstract terms it is component calls worker saga, worker saga has validation logic, but in the validation logic there is a check that input value is changed or not if its not changed then validation does not run.

so proposed solution:

pass a flag = true from the component (onFocus) → saga → worker, and update worker to skip checking if input value is changed when flag is true and thus run validation

another version of same to implement a new function and link it to onFocus

Check can we write some logic A, which calls the validation as in point 1 and 2, and this logic A should run when the related constraint changes, for example in this case, we are switching allowHalfStar from false to true, then logic A should automatically run, and should thus remove the error associated with decimals

for giving an example of point 3: let some saga invoke a validation when allowHalfStart switches | check what possible implications can it have?, will it be a bad solution, if so why?

Let us know which solution is recommended?