Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access property "lastSuccessful", this[taskName] is undefined #420

Closed
esbanarango opened this issue Apr 9, 2021 · 1 comment
Closed
Labels
docs Issues related to documentation v2 Applies to ember-concurrency v2 wontfix

Comments

@esbanarango
Copy link

🐞 Describe the Bug

When using the @lastValue decorator and passing the path of a task. There is an error:

Note: This was working before with ember-concurrency-decorators.

🔬 Minimal Reproduction

export default class MyService extends Service {
  @dropTask
  *myTask() {
    yield null;
  };
}
import { lastValue } from 'ember-concurrency';

export default class MyComponent extends Component {
  @service myService;
  @lastValue('myService.myTask') value;
}

Screen Shot 2021-04-08 at 8 08 30 PM

🌍 Environment

  • "ember-source": "3.26.1",
  • "ember-concurrency": "2.0.3"
@maxfierke
Copy link
Collaborator

maxfierke commented May 31, 2021

Thanks for the heads up about this! I've opened a PR to document this as something that's been removed in ember-concurrency v2, as restoring the behavior would rely on using Ember.get or implementing our own support for chained property access here. I think the recommendation would be to refactor this so that it can read a property directly on the component, e.g.:

import { lastValue } from 'ember-concurrency';

export default class MyComponent extends Component {
  @service myService;
  get myServiceTask() { return this.myService.myTask; }
  @lastValue('myServiceTask') value;
}

Or otherwise, you could put the lastValue on the class as a property if you're reading it a lot / don't need to expose components to the task:

import { lastValue } from 'ember-concurrency';

export default class MyService extends Service {
  @dropTask
  *myTask() {
    yield null;
  };
  @lastValue('myTask') myTaskValue;
}

@maxfierke maxfierke added docs Issues related to documentation v2 Applies to ember-concurrency v2 wontfix labels May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issues related to documentation v2 Applies to ember-concurrency v2 wontfix
Projects
None yet
Development

No branches or pull requests

2 participants