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

async computed transformed into invalid getter #218

Open
jrjohnson opened this issue Nov 3, 2019 · 0 comments
Open

async computed transformed into invalid getter #218

jrjohnson opened this issue Nov 3, 2019 · 0 comments

Comments

@jrjohnson
Copy link

import { computed } from '@ember/object';

const Foo = EmberObject.extend({
  authors: computed('post.comments.authorName', async function () {
    let comments = await this.post.comments;
    return comments.mapBy('authorName');
  }),
});

is transformed into:

import classic from 'ember-classic-decorator';
import { computed } from '@ember/object';

@classic
class Foo extends EmberObject {
  @computed('post.comments.authorName')
  async get authors() {
    let comments = await this.post.comments;
    return comments.mapBy('authorName');
  }
}

However the best info I can find indicates async get permissions() { is not valid syntax.

I'm actually not sure what the best syntax would be for this. Maybe return a Promise wrapped async function? Or an async observer that sets a tracked property?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant