ember-realworld icon indicating copy to clipboard operation
ember-realworld copied to clipboard

Can ember-concurrency be removed?

Open GCheung55 opened this issue 5 years ago • 5 comments

Ember.js is often called out on having a large filesize. I'm wondering if ember-concurrency can be removed in order to reduce the vendor.js filesize.

I understand that it's useful for dropping tasks to prevent multiple executes of a task when a task is already being performed. Perhaps there's an alternative to using a task that can be leveraged?

GCheung55 avatar Aug 29 '19 04:08 GCheung55

Maybe we can just use async await? I like showcasing Ember Concurrency as its an amazing addon though

Alonski avatar Dec 02 '19 08:12 Alonski

If we are actually using any async actions then we should not drop ember-concurrency. You can get yourself into a lot of trouble using async/await for actions and ember-concurrency is currently the most idiomatic way to do this in the Ember ecosystem 👍

mansona avatar Dec 02 '19 14:12 mansona

@mansona What troubles? I use async actions all the time 😅

Alonski avatar Dec 02 '19 15:12 Alonski

@Alonski common troublesome pattern without ember concurrency:

// some component
async function() {
  let val =  await this.doSomething();

  this.set('someProp', val);
}

If the component is destroyed during this.doSomething() the call to set will raise.

jherdman avatar Mar 22 '20 17:03 jherdman

That's a great example @jherdman 🎉

I've also had some issues with testing and timing that cause tests to be a bit intermittent. Most of these issues can be solved by just converting any async actions to Ember Concurrency tasks 👍

mansona avatar Mar 24 '20 10:03 mansona