@@ -13,7 +13,9 @@ exports.canReuse = function (view, handler, transition) {
1313 if ( ! component || ! handler ) {
1414 return false
1515 }
16- if ( component . constructor !== handler . component ) {
16+ // important: check view.Component here because it may
17+ // have been changed in activate hook
18+ if ( view . Component !== handler . component ) {
1719 return false
1820 }
1921 var canReuseFn = util . getRouteConfig ( component , 'canReuse' )
@@ -92,11 +94,12 @@ exports.deactivate = function (view, transition, next) {
9294 *
9395 * @param {Directive } view
9496 * @param {Transition } transition
97+ * @param {Number } depth
9598 * @param {Function } [cb]
9699 */
97100
98- exports . activate = function ( view , transition , cb ) {
99- var handler = transition . activateQueue [ view . depth ]
101+ exports . activate = function ( view , transition , depth , cb ) {
102+ var handler = transition . activateQueue [ depth ]
100103 if ( ! handler ) {
101104 view . setComponent ( null )
102105 cb && cb ( )
@@ -143,7 +146,7 @@ exports.activate = function (view, transition, cb) {
143146 var afterActivate = function ( ) {
144147 // activate the child view
145148 if ( view . childView ) {
146- exports . activate ( view . childView , transition )
149+ exports . activate ( view . childView , transition , depth + 1 )
147150 }
148151 if ( dataHook && waitForData ) {
149152 // wait until data loaded to insert
0 commit comments