gothinkster / ember-realworld

Ember.js RealWorld Implementation
https://ember-realworld.netlify.com/
183 stars 51 forks source link

Can ember-concurrency be removed? #81

Open GCheung55 opened 5 years ago

GCheung55 commented 5 years ago

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?

Alonski commented 4 years ago

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

mansona commented 4 years ago

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 👍

Alonski commented 4 years ago

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

jherdman commented 4 years ago

@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.

mansona commented 4 years ago

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 👍