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

TaskFactory fails without concurrency options argument #472

Closed basz closed 1 year ago

basz commented 1 year ago

This seems to generate an error for me with ember 3.28.9 and ember-concurrency 2.3.0

setupCompanyProfileTask = task(this, async (identity) => {

After migrating to the 'new' syntax I get these run time errors

Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at TaskFactory._processModifierOptions (http://localhost:4201/assets/vendor.js:175460:30)
    at new TaskFactory (http://localhost:4201/assets/vendor.js:175247:12)
    at new TaskFactory (http://localhost:4201/assets/vendor.js:177262:3)
    at buildTask (http://localhost:4201/assets/vendor.js:174122:25)
    at new AccountService (http://localhost:4201/assets/@plhw-lab/lab-plhw.js:95158:89)
    at AccountService.create (http://localhost:4201/assets/vendor.js:29474:20)
    at AccountService.superWrapper (http://localhost:4201/assets/vendor.js:30648:22)
    at AccountService.create (http://localhost:4201/assets/vendor.js:85769:29)
    at AccountService.superWrapper [as create] (http://localhost:4201/assets/vendor.js:30648:22)

Which are fixed by adding a concurrency options argument.

setupCompanyProfileTask = task(this, { drop: false }, async (identity) => {
basz commented 1 year ago

after updating to 2.3.2 this issue was resolved too it seems.

setupCompanyProfileTask = task(this, async (identity) => {

that now works as expected

abel-n commented 1 year ago

As I bumped into this same issue and a regular version update in package.json didn't help, I manually removed the entry for ember-concurrency@1.x, ... from yarn.lock, then ran yarn again and voilà.

Those references were "inherited" from addons like ember-bootstrap, ember-power-select and ember-power-calendar and were resolving to 2.2.1.

joelamb commented 1 year ago

Ran into same issue... seems like updating is the answer, but if you can't update then passing an empty object as the second argument also works:

setupCompanyProfileTask = task(this, {}, async (identity) => {