Skip to content

Commit

Permalink
prettier seems to be flip flopping :/
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Mar 26, 2019
1 parent 0fda207 commit 0bcf4e1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
5 changes: 4 additions & 1 deletion addon/-private/system/model/internal-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,10 @@ export default class InternalModel {

getBelongsTo(key, options) {
let resource = this._recordData.getBelongsTo(key);
let identifier = resource && resource.data ? this.store.identifierCache.getOrCreateRecordIdentifier(resource.data) : null;
let identifier =
resource && resource.data
? this.store.identifierCache.getOrCreateRecordIdentifier(resource.data)
: null;
let relationshipMeta = this.store._relationshipMetaFor(this.modelName, null, key);
let store = this.store;
let parentInternalModel = this;
Expand Down
6 changes: 3 additions & 3 deletions addon/-private/system/record-array-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ export default class RecordArrayManager {
let pending = this._pending[modelName];
let hasPendingChanges = Array.isArray(pending);
let hasNoPotentialDeletions = !hasPendingChanges || pending.length === 0;

// TODO this prevents elimination of "all" behavior
let all = this.store._imCache.all(modelName)
let all = this.store._imCache.all(modelName);
let hasNoInsertionsOrRemovals = all.length === get(array, 'length');

/*
Expand Down Expand Up @@ -207,7 +207,7 @@ export default class RecordArrayManager {

_visibleInternalModelsByType(modelName) {
// TODO this prevents elimination of "all" behavior
let all = this.store._imCache.all(modelName)
let all = this.store._imCache.all(modelName);
let visible = [];
for (let i = 0; i < all.length; i++) {
let model = all[i];
Expand Down
7 changes: 1 addition & 6 deletions addon/-private/system/relationships/state/has-many.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,7 @@ export default class ManyRelationship extends Relationship {
notifyHasManyChange() {
let recordData = this.recordData;
let storeWrapper = recordData.storeWrapper;
storeWrapper.notifyHasManyChange(
recordData.modelName,
recordData.id,
recordData.lid,
this.key
);
storeWrapper.notifyHasManyChange(recordData.modelName, recordData.id, recordData.lid, this.key);
}

getData() {
Expand Down
1 change: 0 additions & 1 deletion addon/-private/system/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ export default class Snapshot {
if (value.data) {
results = [];
value.data.forEach(member => {

let identifier = store.identifierCache.getOrCreateRecordIdentifier(member);
let internalModel = store._imCache.get(identifier);
if (!internalModel.isDeleted()) {
Expand Down
6 changes: 1 addition & 5 deletions tests/integration/records/unload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,11 +756,7 @@ module('integration/unload - Unloading Records', function(hooks) {
});
});

assert.equal(
internalModelsFor(store, 'person').length,
1,
'one person record is loaded'
);
assert.equal(internalModelsFor(store, 'person').length, 1, 'one person record is loaded');
assert.equal(internalModelsFor(store, 'boat').length, 2, 'two boat records are loaded');
assert.equal(store.hasRecordForId('person', 1), true);
assert.equal(store.hasRecordForId('boat', 1), true);
Expand Down
8 changes: 6 additions & 2 deletions tests/integration/relationships/belongs-to-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1949,8 +1949,12 @@ test("belongsTo relationship doesn't trigger when model data doesn't support imp
const createRecordDataFor = env.store.createRecordDataFor;
env.store.createRecordDataFor = function(type, id, lid, storeWrapper) {
if (type === 'book1' || type === 'section') {
let identifier = storeWrapper.store.identifierCache.getOrCreateRecordIdentifier({ type, id, lid });

let identifier = storeWrapper.store.identifierCache.getOrCreateRecordIdentifier({
type,
id,
lid,
});

return new TestRecordData(identifier, storeWrapper);
}
return createRecordDataFor.call(this, type, id, lid, storeWrapper);
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/store/push-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,11 @@ testInDebug('calling push with hasMany relationship the value must be an array',
});

testInDebug('calling push with missing or invalid `id` throws assertion error', function(assert) {
let invalidValues = [{ type: 'person' }, { type: 'person', id: null }, { type: 'person', id: '' }];
let invalidValues = [
{ type: 'person' },
{ type: 'person', id: null },
{ type: 'person', id: '' },
];

assert.expect(invalidValues.length);

Expand Down

0 comments on commit 0bcf4e1

Please sign in to comment.