-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7b5103e
fix whitespace
stefanpenner 3a5a197
tidy-up promise-proxies
stefanpenner fef544f
tidy up adapter-populated-record-array
stefanpenner adc884f
tidy up filtered-record-array
stefanpenner f33d0fc
tidy up record-array
stefanpenner 4c26194
[BUGFIX] recordArray.update() can now be called more then once
stefanpenner 8ed1145
cleanup RecordArray#addInternalModel
stefanpenner c066166
test RecordArray#removeInternalModel
stefanpenner 5f483eb
test RecordArray#save
stefanpenner 641e667
add whitespace
stefanpenner a69fdd7
Add tests for RecordArray.destroy
stefanpenner b93ab53
[BUGFIX] RecordArray snapshot works
stefanpenner c7fab16
test record-array#destroy
stefanpenner 6bf9d46
Fixup record-array/filtered-record-array
stefanpenner 1dd3aaa
Fixup record-array/adapter-populate-record-array
stefanpenner 8fdf8db
tidy up integration/record-array-manager-test
stefanpenner bf9caf9
fix tests for 1.13
stefanpenner 4b5fa40
tidy up some record-array-tests
stefanpenner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import isEnabled from 'ember-data/-private/features'; | |
@module ember-data | ||
*/ | ||
|
||
var get = Ember.get; | ||
const { get } = Ember; | ||
|
||
/** | ||
Represents an ordered list of records whose order and membership is | ||
|
@@ -20,11 +20,15 @@ var get = Ember.get; | |
@extends DS.RecordArray | ||
*/ | ||
export default RecordArray.extend({ | ||
query: null, | ||
init() { | ||
this._super(...arguments); | ||
this.query = this.query || null; | ||
this.links = null; | ||
}, | ||
|
||
replace() { | ||
var type = get(this, 'type').toString(); | ||
throw new Error("The result of a server query (on " + type + ") is immutable."); | ||
let type = get(this, 'type').toString(); | ||
throw new Error(`The result of a server query (on ${type}) is immutable.`); | ||
}, | ||
|
||
_update() { | ||
|
@@ -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')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is mapBy not that great? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
this.setProperties({ | ||
content: Ember.A(internalModels), | ||
isLoaded: true, | ||
|
@@ -56,7 +60,7 @@ export default RecordArray.extend({ | |
this.set('links', cloneNull(payload.links)); | ||
} | ||
|
||
internalModels.forEach((record) => { | ||
internalModels.forEach(record => { | ||
this.manager.recordArraysForRecord(record).add(this); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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