machty / ember-concurrency-decorators

Task decorators for ember-concurrency 1.x (merged into ember-concurrency 2.0)
MIT License
70 stars 25 forks source link

Getters and setters are not supported for task groups #23

Closed mwpastore closed 5 years ago

mwpastore commented 5 years ago

Getting the following error:

ember-concurrency-decorators: Getters and setters are not supported for task groups.

Hopefully I'm doing something braindead here:

import Controller from '@ember/controller';

import { enqueueTaskGroup, task } from 'ember-concurrency-decorators';

export default class DashboardProfileController extends Controller {
  @enqueueTaskGroup saveTaskGroup;

  @task({ group: 'saveTaskGroup' }) saveUserTask = function*(e) {
    e.preventDefault();

    yield this.model.currentUser.save();
  };

  @task({ group: 'saveTaskGroup' }) saveOrganizationTask = function*(e) {
    e.preventDefault();

    yield this.model.organization.save();
  };
}

Thanks in advance.

buschtoens commented 5 years ago

LGTM. What version of ember-cli-babel and configuration are you using? Do you have typescript and / or @ember-decorators/babel-transforms installed? If so, which versions?

mwpastore commented 5 years ago

I have the transform-async-to-generator and transform-async-to-generator Babel plugins installed. That's it, I think.

buschtoens commented 5 years ago

Thank you. I will investigate this evening. In the meantime to unblock yourself, you can safely disable this assertion, without causing any ill effects. It was just meant as an aid to users.

mwpastore commented 5 years ago

Thank you! I rewrote it using the Ember object model, but I'll go back and give that a try.

buschtoens commented 5 years ago

This should not happen any more with 1.0.0-beta.1.

mwpastore commented 5 years ago

Thanks @buschtoens! I'll check it out.

buschtoens commented 5 years ago

@mwpastore Be aware that this requires you to drop all stage 2 decorators and switch to stage 1 decorators though. 😅