appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Bug]: Event gets triggered even when option is not changed

Open shadabbuchh opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

In a TreeSelect widget, on configuring an event for the onOptionChange property we see that the said event gets triggered even when we do not change the selected option.

Steps To Reproduce

  1. D&D a TreeSelect widget.
  2. Configure the onOptionChange event in such a way that we get to see an alert once we change the selected option.
  3. Now open the dropdown of the widget & click on the already selected option.

Expected: The onOptionChange event should not get triggered as we did not change the option. Actual: The event gets triggered.

Public Sample App

No response

Environment

Production

Issue video log

https://www.loom.com/share/48d0980974e646e9b08af14840755430

Version

Cloud

shadabbuchh avatar May 09 '23 06:05 shadabbuchh

@somangshu can i work on this?

skmanoj322 avatar May 09 '23 17:05 skmanoj322

@shadabbuchh can i work on this???

skmanoj322 avatar May 09 '23 17:05 skmanoj322

Greetings @skmanoj322, thanks for showing interest 🎉 , This is all your. Assigning this to you now.

Please don't forget to read the Contribution Guidelines. Would appreciate if you can open a PR within the next 2 days. Please let me know here so that I can take it forward for a review

somangshu avatar May 10 '23 10:05 somangshu

Ok I will start working on this problem and open a pr as soon as possible

skmanoj322 avatar May 10 '23 12:05 skmanoj322

@shadabbuchh it is getting triggered because we are having Click event on the select. for the same Item if you don't want to get triggered then you have to use condition there. Hope it works for you.

So probably you have to make onChange handler instead of Onclick

<select onChange={(event)=>alert(event.target.value)} >

  </select>

Chandan9898Kumar avatar May 10 '23 18:05 Chandan9898Kumar

@Chandan9898Kumar will you be interested in picking this up?

dilippitchika avatar May 16 '23 12:05 dilippitchika

@dilippitchika

I love to work on this ticket, please give me some time to set my repository.

Chandan9898Kumar avatar May 16 '23 18:05 Chandan9898Kumar

@Chandan9898Kumar thanks for showing the interest. Ill keep this issue assigned to you, please let us know here if you raise a PR fixing the issue.

somangshu avatar May 17 '23 10:05 somangshu

ya difficulties i faced is running docker and my pc didnt supported it

skmanoj322 avatar May 17 '23 11:05 skmanoj322

ya difficulties i faced is running docker and my pc didnt supported it

@skmanoj322 I understand that you are keen to work on this ticket, if you have resolved your docker issue then you can connect with @somangshu before i start working on this ticket.

Chandan9898Kumar avatar May 17 '23 14:05 Chandan9898Kumar

No go ahead if find success kindly share

skmanoj322 avatar May 17 '23 14:05 skmanoj322

@somangshu The onOptionChange event should not get triggered until the value is changed for all the options right? I think we can just compare the previous and changed value, if its same we dont need to trigger onoptionchange event. Please let me know if this sounds good I will raise a PR for this. image

harshitpandey0426 avatar May 25 '23 20:05 harshitpandey0426

@harshitpandey0426 go ahead if @somangshu agree with you, even currently I'm facing issues on setting my repo.

Chandan9898Kumar avatar May 26 '23 03:05 Chandan9898Kumar

@harshitpandey0426 yes that is correct, i am assigning this to you. Please feel free to raise a PR in the next 2 days.

@Chandan9898Kumar @skmanoj322 please let us know what are the challenges faced by you in setting up the instance, we will try to support so that you can work on other issues.

dilippitchika avatar May 26 '23 04:05 dilippitchika

@dilippitchika running the docker in local machine is stressing my pc

skmanoj322 avatar May 26 '23 04:05 skmanoj322

@dilippitchika @somangshu Raised PR please have a look

harshitpandey0426 avatar May 26 '23 05:05 harshitpandey0426

Thanks let us check, @vsvamsi1 can you review this as well?

dilippitchika avatar May 26 '23 05:05 dilippitchika

Recording for the test performed after change

https://www.loom.com/share/008d87273b50441f9f56d8f5eef1ed73

harshitpandey0426 avatar May 26 '23 06:05 harshitpandey0426