Repository navigation
Conversation
| @attr() firstName; | ||
| @attr() lastName; | ||
|
|
||
| fullName: computed('firstName', 'lastName', function() { |
There was a problem hiding this comment.
Yup, I think for now we can just make this a standard ES6 getter, and not a computed property
| headers can be set as key/value pairs on the `JSONAPIAdapter`'s `headers` | ||
| object and Ember Data will send them along with each ajax request. | ||
| (Note that we set headers in `init()` because default property values | ||
| (Note that we set headers in `constructor()` because default property values |
There was a problem hiding this comment.
Wouldn't using native classes supersede this implementation quirk ? IIRC, this pattern is because of EmberObject.extend #566
| headers: computed('session.authToken', function() { | ||
| export default class ApplicationAdapter extends JSONAPIAdapter { | ||
| @service session; | ||
| @computed('session.authToken') |
There was a problem hiding this comment.
I think we can remove @computed here and just make this a tracked property
There was a problem hiding this comment.
Rather, session.authToken should be considered a tracked property, and this can just be a normal getter
|
|
||
| ```javascript {data-filename=app/serializers/post.js} | ||
| import DS from 'ember-data'; | ||
| const { EmbeddedRecordsMixin, JSONSerializer } = DS; |
There was a problem hiding this comment.
The EmbeddedRecordsMixin will be tricky, ideally we can avoid mixins altogether. We'll have to work with the Ember Data team to figure out what the future is here.
There was a problem hiding this comment.
indeed. I chatted briefly with @runspired in #dev-ember-data to get a quick port of the syntax. Same theme there.
| @attr() firstName; | ||
| @attr() lastName; | ||
|
|
||
| fullName: computed('firstName', 'lastName', function() { |
There was a problem hiding this comment.
Yup, I think for now we can just make this a standard ES6 getter, and not a computed property
Yes. See also the blueprints we just merged that do destructure. |
|
Thank you @efx for your work and sorting out some of these open questions! |
Current progress addressing #543.
See background discussion in the dev-ember-learning channel.
open questions / related issues
standardize decorators and remove usage of ember-decoratorsconst { Model, attr } = DS;to then use@attrfor model attributes. I think this syntax is clearer, but it is slightly inconsistent with example ember-data snippets. (e.g. extendingDS.JSONSerializer). Should we use destructuring anywhere we import fromDS?