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

fix: don't trigger submit action twice #5658

Merged
merged 9 commits into from
Nov 18, 2020
Merged

fix: don't trigger submit action twice #5658

merged 9 commits into from
Nov 18, 2020

Conversation

maze-runnar
Copy link
Contributor

Fixes #5655

  • currently made changes for billing section.

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@auto-label auto-label bot added the fix label Nov 16, 2020
@vercel
Copy link

vercel bot commented Nov 16, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/qujlt09ce
✅ Preview: https://open-event-frontend-git-twice-action.eventyay.vercel.app

@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #5658 (6d40195) into development (9dfeef4) will decrease coverage by 0.30%.
The diff coverage is 33.33%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #5658      +/-   ##
===============================================
- Coverage        23.73%   23.43%   -0.31%     
===============================================
  Files              498      508      +10     
  Lines             5275     5377     +102     
  Branches            47       47              
===============================================
+ Hits              1252     1260       +8     
- Misses            4015     4109      +94     
  Partials             8        8              
Impacted Files Coverage Δ
app/components/forms/admin/settings/billing.js 0.00% <0.00%> (ø)
app/components/forms/orders/order-form.js 0.00% <ø> (ø)
app/components/forms/user-payment-info-form.js 26.66% <0.00%> (-1.91%) ⬇️
app/components/forms/login-form.js 60.60% <100.00%> (+1.23%) ⬆️
app/components/modals/modal-base.js 22.85% <0.00%> (-1.39%) ⬇️
app/router.js 100.00% <0.00%> (ø)
app/routes/index.js 78.57% <0.00%> (ø)
app/serializers/event-statistics-general.js 0.00% <0.00%> (ø)
app/controllers/events/view/tickets/orders/list.js 0.00% <0.00%> (ø)
.../controllers/events/view/tickets/attendees/list.js 0.00% <0.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9dfeef4...6d40195. Read the comment docs.

@iamareebjamal
Copy link
Member

Can I submit the form by clicking enter on any field. And this is not the only form with class syntax

@maze-runnar
Copy link
Contributor Author

Can I submit the form by clicking enter on any field.

Yes

@@ -88,5 +88,5 @@
<label for="adminBillingAdditionalInfo">{{t 'Additional Info'}}</label>
<Input @type="text" @id="adminBillingAdditionalInfo" @value={{this.model.adminBillingAdditionalInfo}} />
</div>
<button class="ui teal button" type="submit" name="submit">{{t 'Save'}}</button>
<button class="ui teal button" type="button" name="submit" onclick={{action "submit"}}>{{t 'Save'}}</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be needed, just type="submit" should do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keeping it to submit that is triggering twice

@maze-runnar
Copy link
Contributor Author

@iamareebjamal why build is failing Error: Element not found when calling click('button[type=submit]')``` acceptance test. `

@iamareebjamal
Copy link
Member

Because there is no submit type button in the form now.

Honestly, it should work without changing button submit, check here - 5c3d8f5

@maze-runnar
Copy link
Contributor Author

ok

@maze-runnar
Copy link
Contributor Author

@iamareebjamal please review.

@@ -88,5 +88,5 @@
<label for="adminBillingAdditionalInfo">{{t 'Additional Info'}}</label>
<Input @type="text" @id="adminBillingAdditionalInfo" @value={{this.model.adminBillingAdditionalInfo}} />
</div>
<button class="ui teal button" type="submit" name="submit">{{t 'Save'}}</button>
<button class="ui teal button" type="submit" name="submit" onclick={{action "submit"}}>{{t 'Save'}}</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed?

@@ -35,7 +35,7 @@
</div>
<div class="ui center aligned segment basic">
<div class="ui vertical buttons">
<button type="submit" class="ui fluid teal submit button register">
<button type="submit" class="ui fluid teal submit button register" onclick={{action "submit"}}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it's not 😕 . But why, I don't understand. If my action name is other than submit then it will be needed or will work in same way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, looks like the form mixin shenanigans

@iamareebjamal iamareebjamal merged commit aa99edd into fossasia:development Nov 18, 2020
@maze-runnar maze-runnar deleted the twice-action branch November 18, 2020 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Class based forms trigger submit action twice
2 participants