machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
691 stars 155 forks source link

task does not seem to return a Task object #473

Closed basz closed 1 year ago

basz commented 1 year ago

using a the perform template helper or calling a task with perform result in an error.

ember 3.28.9 and ember-concurrency 2.3.0

@onClick={{perform this.switchProfile.switchTask}} 
testTast = task(this, { drop: true }, async () => {
    await alert(1);
  });
Assertion Failed: The first argument passed to the `perform` helper should be a Task object (without quotes); you 
passed function () { for (var _len2 = arguments.length, desc = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) 
{ desc[_key2] = arguments[_key2]; } return descriptorFn(...desc, params); }

@onClick={{this.onClick}}
@action
  onClick() {
    this.testTask.perform();
  }

  testTask = task(this, { drop: true }, async () => {
    await alert(1);
  });
this.testTask.perform is not a function
basz commented 1 year ago

see #471

machty commented 1 year ago

@basz can you look through your compiled JS code for testTask (you may need to "unminify" in dev tools) and paste what it looks like?

urbany commented 1 year ago

@basz check here, maybe yours is the same problem: https://github.com/machty/ember-concurrency/issues/471#issuecomment-1225712872

basz commented 1 year ago

yes, that solved the issue! great.