lundi 13 mai 2019

Cant we put a ember concurrency task in glimmer component getter, which is tracking the components arguments

-- when an ember concurrency task is called glimmer components getter then it runs in infinite loop.

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';

export default class UserTableComponent extends Component {
  @service store;
  @tracked users;

  get taskStatus() {
    let params = {
      'account_id':this.args.account,
      'page':this.args.page
    }
    this.getUsersTask.perform(params);

  }


  @task(function*(params) {
      let recordsWithMeta = yield this.store.query('user', params);
      this.users= recordsWithMeta.toArray();
    }) getUsersTask;

}


<UserTable 
  @account=
  @page=
  >          
</UserTable>

Note: it runs in infinite loop.




Aucun commentaire:

Enregistrer un commentaire