Skip to content

fix: Replace Promise.allSettled by RSVP.allSettled #4408

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

Merged
merged 9 commits into from
Jun 17, 2020

Conversation

EmperorYP7
Copy link
Contributor

@EmperorYP7 EmperorYP7 commented May 26, 2020

Fixes #4401

Short description of what this resolves:

Attempted to add polyfilled function to the relevant files to enhance compatibility across browsers.

Changes proposed in this pull request:

-Replacing Promise.allSettled() function with RSVP.allSettled() function in the app files.

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)

@vercel
Copy link

vercel bot commented May 26, 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/6z5q6lu07
✅ Preview: https://open-event-frontend-git-fork-emperoryp7-development.eventyay.vercel.app

@lgtm-com
Copy link

lgtm-com bot commented May 26, 2020

This pull request introduces 2 alerts when merging ff70533 into 366d144 - view on LGTM.com

new alerts:

  • 2 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented May 26, 2020

This pull request introduces 2 alerts when merging 36b5afc into 366d144 - view on LGTM.com

new alerts:

  • 2 for Unused variable, import, function or class

@@ -2,6 +2,7 @@ import classic from 'ember-classic-decorator';
import { action, computed } from '@ember/object';
import Controller from '@ember/controller';
import { htmlSafe } from '@ember/string';
import { allSettled } from 'rsvp';
Copy link
Member

Choose a reason for hiding this comment

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

As the review says, you imported the function but never used it

} catch (error) {
console.error('Error while deleting attendees after order failure', error);
}
await RSVP.allSettled(attendees ? attendees.toArray() : []).then(attendee => attendee.destroyRecord(),
Copy link
Member

Choose a reason for hiding this comment

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

There is no RSVP defined and there is no need to change from try catch to then catch

@iamareebjamal
Copy link
Member

As you can already see, the build is failing

@vercel vercel bot temporarily deployed to Preview May 27, 2020 12:41 Inactive
@codecov
Copy link

codecov bot commented May 27, 2020

Codecov Report

Merging #4408 into development will increase coverage by 0.28%.
The diff coverage is 0.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #4408      +/-   ##
===============================================
+ Coverage        22.28%   22.57%   +0.28%     
===============================================
  Files              469      468       -1     
  Lines             4950     4962      +12     
  Branches             6        6              
===============================================
+ Hits              1103     1120      +17     
+ Misses            3846     3841       -5     
  Partials             1        1              
Impacted Files Coverage Δ
app/controllers/public/index.js 5.88% <0.00%> (-0.79%) ⬇️
app/mixins/event-wizard.js 1.21% <0.00%> (ø)
app/components/public/ticket-list.js 17.69% <0.00%> (-0.82%) ⬇️
app/initializers/accounting.js
app/controllers/index.js 70.00% <0.00%> (+30.00%) ⬆️
app/models/event.js 53.84% <0.00%> (+30.76%) ⬆️
app/utils/internal.js 75.00% <0.00%> (+50.00%) ⬆️
app/mixins/custom-primary-key.js 50.00% <0.00%> (+50.00%) ⬆️

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 063f66b...4fcd28a. Read the comment docs.

@EmperorYP7
Copy link
Contributor Author

As you can already see, the build is failing

Tried to implement it again, sir. Hope this'd solve the issues.

@@ -48,7 +48,7 @@ export default Mixin.create(MutableArray, CustomFormMixin, {
async saveEventData(propsToSave = []) {
const { event } = this.model;
const data = {};
const results = await Promise.allSettled(propsToSave.map(property => {
const results = await RSVP.allSettled(propsToSave.map(property => {
Copy link
Member

Choose a reason for hiding this comment

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

Return type of RSVP.allSettled is different from Promise.allSettled. Please fix the code accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to get around this, sir. Do review it once. Any specific suggestion or resource to guide me through this?

Copy link
Member

Choose a reason for hiding this comment

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

Resolve conflicts and I will test the results

@vercel vercel bot temporarily deployed to Preview June 17, 2020 23:33 Inactive
@iamareebjamal iamareebjamal changed the title Replaced Promise.allSettled by RSVP.allSettled fix: Replace Promise.allSettled by RSVP.allSettled Jun 17, 2020
@iamareebjamal iamareebjamal merged commit ccbf44c into fossasia:development Jun 17, 2020
@EmperorYP7
Copy link
Contributor Author

Thank you sir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Promise.allSettled by RSVP.allSettled
2 participants