I followed EmberMaps guide and updated the Ember app from 3.5.1 to 3.7.1 and one route fails with the following message:
Assertion Failed: EmberObject.create no longer supports defining computed properties. Define computed properties using extend() or reopen() before calling create().
I’ve already searched for possible appearance of EmberObject.create
in the code and fixed some ones as follows:
#components/event-form.js
import Component from '@ember/component';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
import { translationMacro as t } from "ember-i18n";
import EmberObject from '@ember/object';
export default Component.extend({
...
_allSportsEntry() {
let all = EmberObject.extend({
id: 999999,
label: 'All sports'
}).create();
return all;
}
});
There are no other search results, only in some add-ons:
- dist/assets/vendor.js
- node_modules/ember-data-url-tempplates/addon/mixins/url-template.js
- node_modules/ember-i18n/addon/helper.js and some testing modules that I think should not be taken into account.
How to find where it comes from and to fix that ?
Here is the screenshot of the browser console displaying the error.
When switching back to 3.5.1
version, everything works as needed.
Here is the route I hit when it happens (the same error in edit
route as well):
#routes/country-events/new.js
export default Route.extend(AuthenticatedRouteMixin, {
currentShop: service(),
model() {
return RSVP.hash({
countries: this.store.findAll('country', { include: 'languages' }),
sports: this.store.findAll('sport'),
event: this.store.createRecord('event')
});
}
});
Any ideas ? Thank you !