Skip to content

Commit

Permalink
Strip deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav0 committed Dec 6, 2019
1 parent a11204e commit 68577ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/private-build-infra/addon/current-deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ export default {
DEPRECATE_METHOD_CALLS_ON_DESTROY_STORE: '3.15',
DEPRECATE_MISMATCHED_INVERSE_RELATIONSHIP_DATA: '3.12',
DEPRECATE_SERIALIZER_QUERY_RECORD_ARRAY_RESPONSE: '3.4',
DEPRECATE_BELONGS_TO_REFERENCE_PUSH: '3.16',
};
19 changes: 12 additions & 7 deletions packages/store/addon/-private/system/references/belongs-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Reference from './reference';
import recordDataFor from '../record-data-for';
import { peekRecordIdentifier } from '../store/internal-model-factory';
import { deprecate } from '@ember/debug';
import { DEPRECATE_BELONGS_TO_REFERENCE_PUSH } from '@ember-data/private-build-infra/deprecations';

/**
@module @ember-data/store
Expand Down Expand Up @@ -129,13 +130,17 @@ export default class BelongsToReference extends Reference {
return resolve(objectOrPromise).then(data => {
let record;

if (peekRecordIdentifier(data)) {
deprecate('Pushing a record into a BelongsToReference is deprecated', false, {
id: 'ember-data:belongs-to-reference-push-record',
until: '4.0',
});
record = data;
} else {
if (DEPRECATE_BELONGS_TO_REFERENCE_PUSH) {
if (peekRecordIdentifier(data)) {
deprecate('Pushing a record into a BelongsToReference is deprecated', false, {
id: 'ember-data:belongs-to-reference-push-record',
until: '4.0',
});
record = data;
}
}

if (typeof record === 'undefined') {
record = this.store.push(data);
}

Expand Down

0 comments on commit 68577ab

Please sign in to comment.