ember-native-class-codemod
ember-native-class-codemod copied to clipboard
async computed transformed into invalid getter
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?