@@ -5537,7 +5537,7 @@ function _inject(definition, resource, attrs) {
55375537 return injected ;
55385538}
55395539
5540- function _injectRelations ( definition , injected , options , injectedSoFar ) {
5540+ function _injectRelations ( definition , injected , options ) {
55415541 var DS = this ;
55425542 DS . utils . forOwn ( definition . relations , function ( relatedModels , type ) {
55435543 DS . utils . forOwn ( relatedModels , function ( defs , relationName ) {
@@ -5546,10 +5546,10 @@ function _injectRelations(definition, injected, options, injectedSoFar) {
55465546 }
55475547
55485548 function _process ( def , injected ) {
5549- if ( DS . definitions [ relationName ] && injected [ def . localField ] && ! injectedSoFar [ relationName + injected [ def . localField ] [ DS . definitions [ relationName ] . idAttribute ] ] ) {
5549+ if ( DS . definitions [ relationName ] && injected [ def . localField ] && ! data . injectedSoFar [ relationName + injected [ def . localField ] [ DS . definitions [ relationName ] . idAttribute ] ] ) {
55505550 try {
5551- injectedSoFar [ relationName + injected [ def . localField ] [ DS . definitions [ relationName ] . idAttribute ] ] = 1 ;
5552- injected [ def . localField ] = DS . inject ( relationName , injected [ def . localField ] , options , injectedSoFar ) ;
5551+ data . injectedSoFar [ relationName + injected [ def . localField ] [ DS . definitions [ relationName ] . idAttribute ] ] = 1 ;
5552+ injected [ def . localField ] = DS . inject ( relationName , injected [ def . localField ] , options ) ;
55535553 } catch ( err ) {
55545554 DS . $log . error ( errorPrefix ( definition . name ) + 'Failed to inject ' + type + ' relation: "' + relationName + '"!' , err ) ;
55555555 }
@@ -5637,7 +5637,7 @@ function _injectRelations(definition, injected, options, injectedSoFar) {
56375637 * @returns {object|array } A reference to the item that was injected into the data store or an array of references to
56385638 * the items that were injected into the data store.
56395639 */
5640- function inject ( resourceName , attrs , options , injectedSoFar ) {
5640+ function inject ( resourceName , attrs , options ) {
56415641 var DS = this ;
56425642 var IA = DS . errors . IA ;
56435643 var definition = DS . definitions [ resourceName ] ;
@@ -5663,13 +5663,13 @@ function inject(resourceName, attrs, options, injectedSoFar) {
56635663 try {
56645664 if ( ! DS . $rootScope . $$phase ) {
56655665 DS . $rootScope . $apply ( function ( ) {
5666- injected = _inject . call ( DS , definition , resource , attrs , injectedSoFar || data . injectedSoFar ) ;
5666+ injected = _inject . call ( DS , definition , resource , attrs ) ;
56675667 } ) ;
56685668 } else {
5669- injected = _inject . call ( DS , definition , resource , attrs , injectedSoFar || data . injectedSoFar ) ;
5669+ injected = _inject . call ( DS , definition , resource , attrs ) ;
56705670 }
56715671 if ( definition . relations ) {
5672- _injectRelations . call ( DS , definition , injected , options , injectedSoFar || data . injectedSoFar ) ;
5672+ _injectRelations . call ( DS , definition , injected , options ) ;
56735673 }
56745674
56755675 DS . notify ( definition , 'inject' , injected ) ;
0 commit comments