@@ -14,6 +14,7 @@ import { setTransform } from 'ember-nav-stack/utils/animation';
14
14
import { inject as service } from '@ember/service' ;
15
15
import { bool , mapBy , reads } from 'macro-decorators' ;
16
16
import { guidFor } from '@ember/object/internals' ;
17
+ import { extractComponentKey } from 'ember-nav-stack/utils/component'
17
18
18
19
function currentTransitionPercentage ( fromValue , toValue , currentValue ) {
19
20
if ( fromValue === undefined || fromValue === toValue ) {
@@ -155,7 +156,7 @@ export default class NavStack extends Component {
155
156
let stackItems = this . stackItems || [ ] ;
156
157
let stackDepth = stackItems . length ;
157
158
let rootComponentRef = stackItems [ 0 ] && stackItems [ 0 ] . component ;
158
- let rootComponentIdentifier = getComponentIdentifier ( rootComponentRef ) ;
159
+ let rootComponentKey = this . args . extractComponentKey ? this . args . extractComponentKey ( rootComponentRef ) : extractComponentKey ( rootComponentRef ) ;
159
160
160
161
let layer = this . args . layer ;
161
162
if ( isInitialRender ) {
@@ -171,7 +172,7 @@ export default class NavStack extends Component {
171
172
this . element . style . display = 'none' ;
172
173
this . schedule ( this . slideDown ) ;
173
174
174
- } else if ( rootComponentIdentifier !== this . _rootComponentIdentifier ) {
175
+ } else if ( rootComponentKey !== this . _rootComponentKey ) {
175
176
this . schedule ( this . cut ) ;
176
177
177
178
} else if ( stackDepth < this . _stackDepth ) {
@@ -185,7 +186,7 @@ export default class NavStack extends Component {
185
186
}
186
187
187
188
this . _stackDepth = stackDepth ;
188
- this . _rootComponentIdentifier = rootComponentIdentifier ;
189
+ this . _rootComponentKey = rootComponentKey ;
189
190
}
190
191
191
192
schedule ( method ) {
@@ -574,25 +575,3 @@ export default class NavStack extends Component {
574
575
return x ;
575
576
}
576
577
}
577
-
578
- function getComponentIdentifier ( componentRef ) {
579
- if ( ! componentRef ) {
580
- return 'none' ;
581
- }
582
- let result = componentRef . name || componentRef . inner . name ;
583
- if ( componentRef . args . named . model ) {
584
- let model = componentRef . args . named . model . value ( ) ;
585
- if ( model ) {
586
- result += `:${ get ( model , 'id' ) } ` ;
587
- }
588
- } else if ( componentRef . args . named . has && componentRef . args . named . has ( 'model' ) ) {
589
- let model = componentRef . args . named . get ( 'model' ) . value ( ) ;
590
- if ( model ) {
591
- let modelId = get ( model , 'id' ) ;
592
- if ( modelId ) {
593
- result += `:${ modelId } ` ;
594
- }
595
- }
596
- }
597
- return result ;
598
- }
0 commit comments