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

Cleanup record array manager #4591

Merged
merged 18 commits into from
Oct 19, 2016
Merged

Conversation

stefanpenner
Copy link
Member

No description provided.

* add tests
* remove unused feature of passing in an optional index to insert at
* leave note for future work, e.g. the cleanup that is happening should likely not happen.
* recordArray.invoke(‘createSnapshot’) was previously invoked on the result of `internal.getRecord()` which no longer has createSnapshot, but `invoke` doesn’t error if a method isn’t found.
* recordArray.snapshot is private, we should underscore it
* add tests
* ensure filter function updates just before destroy are ignored
* add unit test coverage for what makes filtered-record-arrays different then RecordArray
query: null,
init() {
this._super(...arguments);
this.query = this.query || null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the guard against existing on query and not on links

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is due to links is state provided by internal loadRecords, and not via the constructor

@@ -44,7 +48,7 @@ export default RecordArray.extend({
loadRecords(records, payload) {
let token = heimdall.start('AdapterPopulatedRecordArray.loadRecords');
//TODO Optimize
var internalModels = Ember.A(records).mapBy('_internalModel');
let internalModels = records.map(record => get(record, '_internalModel'));
Copy link
Member

@igorT igorT Oct 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is mapBy not that great?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Ember.A() is heavy weight, for merely doing something map + => can do.

@stefanpenner stefanpenner force-pushed the cleanup-record-array-manager branch 3 times, most recently from d2ddd72 to fb3a66f Compare October 19, 2016 19:24
* move to integration (as it is tests interaction between store/manager/array)
* remove unit tests already covered by tests/unit/record-arrays/record-arrays-test
* cleanup file
@stefanpenner stefanpenner merged commit 8e6a753 into master Oct 19, 2016
@stefanpenner stefanpenner deleted the cleanup-record-array-manager branch October 19, 2016 20:39
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

Successfully merging this pull request may close these issues.

None yet

3 participants