File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ export class Transition implements IHookRegistry {
165
165
* @param state (optional) the state in the topath which should receive the new resolves (otherwise, the root state)
166
166
*/
167
167
addResolves ( resolves : IResolveDeclarations , state : IStateOrName = "" ) {
168
- let stateName = < string > ( < any > state ) . name ? ( < any > state ) . name : state ;
168
+ let stateName : string = ( typeof state === "string" ) ? state : state . name ;
169
169
let topath = this . _treeChanges . to ;
170
170
let targetNode = find ( topath , node => node . state . name === stateName ) ;
171
171
tail ( topath ) . resolveContext . addResolvables ( Resolvable . makeResolvables ( resolves ) , targetNode . state ) ;
Original file line number Diff line number Diff line change @@ -91,17 +91,20 @@ export default class TransitionHook {
91
91
let results = [ ] ;
92
92
for ( let i = 0 ; i < hooks . length ; i ++ ) {
93
93
try {
94
- let hookResult = hooks [ i ] . invokeStep ( locals ) ;
95
- let rejection = TransitionHook . isRejection ( hookResult ) ;
96
- if ( rejection ) return rejection ;
97
- results . push ( hookResult ) ;
94
+ results . push ( hooks [ i ] . invokeStep ( locals ) ) ;
98
95
} catch ( exception ) {
99
96
if ( ! swallowExceptions ) throw exception ;
100
97
console . log ( "Swallowed exception during synchronous hook handler: " + exception ) ; // TODO: What to do here?
101
98
}
102
99
}
103
100
104
- return results . filter ( < Predicate < any > > isPromise ) . reduce ( ( chain , promise ) => chain . then ( val ( promise ) ) , runtime . $q . when ( ) ) ;
101
+ let rejections = results . filter ( TransitionHook . isRejection ) ;
102
+ if ( rejections . length ) return rejections [ 0 ] ;
103
+
104
+ return results
105
+ . filter ( not ( TransitionHook . isRejection ) )
106
+ . filter ( < Predicate < any > > isPromise )
107
+ . reduce ( ( chain , promise ) => chain . then ( val ( promise ) ) , runtime . $q . when ( ) ) ;
105
108
}
106
109
107
110
You can’t perform that action at this time.
0 commit comments