Closed urbany closed 1 year ago
@urbany can you find the compiled JS code for myTask
and paste it here? e.g. find what myTask = task(this, async () => {
compiles to.
After talking to @machty on discord it seems to be a problema with a babel transform not running. We're not sure how to debug, and a small reproduction is needed.
Figured it out. Was using tasks in an in-app addon without declaring ember-concurrency as a dependency of the addon. Added id to my in-app addon package.json and now it is working @machty you can close this if you want.
I seem to have a similar issue but have no idea how to debug this. The transpilation doesn't run.
Reproduction: https://ember-twiddle.com/df50d8a9f24a72674ada3f32ab263023
Error: Assertion Failed: It appears you're attempting to use the new task(async () => { ... }) syntax, but the async arrow task function you've provided is not being properly compiled by Babel.
1. You must pass the async function expression directly to the task() function (it is not currently supported to pass in a variable containing the async arrow fn, or any other kind of indirection)
My code: test = task(async () => {});
Transpiled code:
_defineProperty(this, "test", (cov_1uxrpjaiu0().s[14]++, (0, _emberConcurrency.task)(async () => { cov_1uxrpjaiu0().f[4]++; })));
2. If this code is in an addon, please ensure the addon specificies ember-concurrency "2.3.0" or higher in "dependencies" (not "devDependencies") It is not an addon
3. Ensure that there is only one version of ember-concurrency v2.3.0+ being used in your project (including nested dependencies) and consider using npm/yarn/pnpm resolutions to enforce a single version is used
npm ls ember-concurrency
shows only one ember-concurrency@2.3.4
@olyckne I don't know if ember-twiddle is going to support the new transpiled Task syntax or not, but I think maybe your issue is that you're still using @task
as a decorator, but the decorator isn't necessary anymore.
Instead of
@task
foo = task(async () => {
// ...
});
just do
foo = task(async () => {
// ...
});
@machty After some investigating, I found the problem. It's something with coverage mentioned in https://github.com/machty/ember-concurrency/issues/483
I always run npm start
which in my application translates to cross-env COVERAGE=true ember serve
. Took a while to connect the dots :)
Hi, first of all thank you all for the work on this addon!
Ember: 3.28.9
Error
If I check myTask it says it is this function
taskComputed
:Previous
@task *myTask
syntax is still working.EDIT: also checked how the task is being defined, and there seems to be something wrong here, my fn is being ignored, and my service is being used to
buildClassicTaskProperty