Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: app repository Install Repo button fires twice (sometimes) #3678

Closed
dlaloue-vmware opened this issue Oct 27, 2021 · 2 comments · Fixed by #3891
Closed

UI: app repository Install Repo button fires twice (sometimes) #3678

dlaloue-vmware opened this issue Oct 27, 2021 · 2 comments · Fixed by #3891
Assignees
Labels
component/ui Issue related to kubeapps UI good first issue kind/bug An issue that reports a defect in an existing feature
Projects

Comments

@dlaloue-vmware
Copy link
Collaborator

Description:

I ran several times into the use case where clicking the "Install Repo" button to add a new app repository is being executed twice, resulting in an error message being displayed.
The first execution seems to properly create the app repository, and does not seem to be affected by the second execution.

Describe the results you expected:

Any submit button should be guarded from firing multiple times.

@project-bot project-bot bot added this to Inbox in Kubeapps Oct 27, 2021
@absoludity
Copy link
Contributor

I've noticed the same for the validation of an app repository (two requests).

@absoludity absoludity added component/ui Issue related to kubeapps UI kind/bug An issue that reports a defect in an existing feature priority/low labels Oct 28, 2021
@ppbaena ppbaena moved this from Inbox to Backlog in Kubeapps Nov 8, 2021
@ppbaena ppbaena moved this from Backlog to Next iteration discussion in Kubeapps Nov 22, 2021
@ppbaena ppbaena moved this from Next iteration discussion to Committed in Kubeapps Nov 22, 2021
@ppbaena ppbaena moved this from Committed to Next iteration discussion in Kubeapps Nov 22, 2021
@castelblanque castelblanque moved this from Next iteration discussion to In progress in Kubeapps Nov 30, 2021
@castelblanque castelblanque self-assigned this Nov 30, 2021
@castelblanque
Copy link
Collaborator

Not an easy one :)

There are redundant calls int AppRepoForm.tsx:

  • onClick of the button in the form, triggers the install logic -> <CdsButton disabled={validating} onClick={install}>
  • handleInstallClickfunction calls install logic as well upon submission of form -> <form onSubmit={handleInstallClick}>

However, the problem I'm facing with Jest is that simulating the 'click' on the button (having it changed to type=submit) is not submitting the form in the tests.
After some research, I found this issue, which is mentioned in an old Kubeapps issue.
Instead, if simulate('submit') is used with the button instance, disable status is not honored and can be invoked multiple times.

Will continue investigating tomorrow 👀

castelblanque pushed a commit that referenced this issue Dec 2, 2021
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
@castelblanque castelblanque moved this from In progress to Waiting For Review in Kubeapps Dec 2, 2021
castelblanque pushed a commit that referenced this issue Dec 2, 2021
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
castelblanque pushed a commit that referenced this issue Dec 2, 2021
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
castelblanque pushed a commit that referenced this issue Dec 3, 2021
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Kubeapps automation moved this from Waiting For Review to Done Dec 7, 2021
castelblanque added a commit that referenced this issue Dec 7, 2021
* Fix install repo firing twice (#3678)

Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>

* Run forgotten Prettier (#3678)

Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>

* Fix broken AppRepoForm test (#3678)

Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>

* Modified variable name (#3678)

Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ui Issue related to kubeapps UI good first issue kind/bug An issue that reports a defect in an existing feature
Projects
No open projects
Kubeapps
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants