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

waitForProperty not resolving for encapsulated taskInstance return value #459

Open
colenso opened this issue Apr 1, 2022 · 0 comments
Open
Labels
bug v2 Applies to ember-concurrency v2

Comments

@colenso
Copy link

colenso commented Apr 1, 2022

I've created a dummy project to demo this: https://github.com/colenso/concurrency-test

@task encapsulatedTask = {
   *perform(value) {
     console.log('encapsulated waiting for 5 seconds');
     yield timeout(5000);
     console.log('encapsulated all done waiting');
     return 'all good';
   }
 }
 
 @task
 *printEncapsulatedTaskValue() {
   this.encapsulatedTask.perform();
   let value = yield waitForProperty(this.encapsulatedTask, 'last.value');
   console.log('encapsulated value: ', value);
 }

In the code above ☝️ the encapsulated value is never printed to the console. We do however see the logs to indicate that the encapsulatedTask ran fine.

However for a normal task like:

@task
  *normalTask() {
    console.log('normal: waiting for 5 seconds');
    yield timeout(5000);
    console.log('normal: all done waiting');
    return 'all good';
  }
  
  @task
  *printNormalTaskValue() {
    this.normalTask.perform();
    let value = yield waitForProperty(this.normalTask, 'last.value');
    console.log('normal value: ', value);
  }

The waitForProperty resolves just fine and we get to see normal value: all good on the console.

@colenso colenso changed the title waitForProperty not resolving for encapsulated taskInstance waitForProperty not resolving for encapsulated taskInstance return value Apr 1, 2022
@maxfierke maxfierke added bug v2 Applies to ember-concurrency v2 labels Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug v2 Applies to ember-concurrency v2
Projects
None yet
Development

No branches or pull requests

2 participants