-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Introduce ember-concurrency with examples #977
Introduce ember-concurrency with examples #977
Conversation
I can not get the tests to fail locally (in browser or in phantom/CI). Is this a know bug? Oddly the failed assertion is failing with the same predicate that the wait helper polls on the line before it. It seems odd that the element is there andThen(() => {
waitToDisappear('.modal-dialog');
// Wait with polling till this element exists (length > 0)
waitToAppear('a.secondary-diagnosis:contains(Tennis Elbow)');
});
andThen(() =>{
// It dies here because it can not find the element (length === 0)
assert.equal(find('a.secondary-diagnosis:contains(Tennis Elbow)').length, 1, 'New secondary diagnosis appears');
click('a:contains(Add Operative Plan)');
waitToAppear('span.secondary-diagnosis:contains(Tennis Elbow)');
}); WTF am I missing?! |
1..907
# tests 907
# pass 907
# skip 0
# fail 0
# ok Both on master and on this branch. Beyond confused. I swear Travis hates me. |
@sukima welcome to my pain with Travis! Yeah, I'm not sure what/why it does that. Usually I just restart Travis and it will pass. I'll do that with this PR and see if it passes. |
@sukima it is a different issue because I can get it to reproduce at various times. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sukima I really like how this cleans up the code. Thanks for the PR! I'm in favor of merging this in, as long as you can make the change suggested below.
app/admin/address/route.js
Outdated
}); | ||
} | ||
}.property() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have been trying to move HospitalRun away from using property() to define computed properties
Can we change this to follow this: https://github.com/DockYard/styleguides/blob/master/engineering/ember.md#dont-use-embers-prototype-extensions
Basically change
defaultAddressOption: function() {
...
}.property()
to
defaultAddressOption: computed(function() {
...
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely! I prefer DockYard's style better. I only kept this because I thought it was the style choice based on looking at the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. And rebased!
5b37175
to
57e63fb
Compare
This is the example I used in issue HospitalRun#969. It is illustrates how to use ember-concurrency tasks in routes.
Example of using ember-concurrency tasks to manage a complex promise chain of events. I picked this one mainly because I wanted to illustrate the simplicity of using e-c tasks to manage what was otherwise a very complex promise chain. I tried to preserve some of the concurrency described in the previous promise based code. However, after some analysis and discussion on the Ember Slack channels difference between preserving the concurrency and just running the resolutions serially are likely very small. In this case the use of `all()` could likely be removed without a significant impact on performance. I mention this later optimisation as a way to make the code even easier to grok. I'll leave the debate to further discussion.
57e63fb
to
b71ed05
Compare
@jkleinsc Bump. changes complete. Ready for review. |
@sukima Looks good to me. I'll merge it in today. |
Closes #969
This PR adds the ember-concurrency addon and includes two examples of refactors.
I wrote more notes in the commit messages.