@@ -149,35 +149,24 @@ function executeUserFunctionDispatch (
149149 // check if the user function dispatches any event
150150 const eventTargets = findEventTargets ( events , dispatchType ) ;
151151 if ( eventTargets && eventTargets . length > 0 ) {
152+ payload = dispatchPayloads [ dispatchType ] ;
153+ if ( process . env . NODE_ENV !== 'production' ) {
154+ sendDebugMessage ( {
155+ key : functionKey ,
156+ eventType : constants . DEBUG_MSG_FUNCTION_FIRE_EVENT ,
157+ eventName : dispatchType ,
158+ outputData : payload ,
159+ functionName : functionName ,
160+ timestamp : Date . now ( ) ,
161+ } ) ;
162+ }
152163 eventTargets . forEach ( eventTarget => {
153164 const { type : eventTargetType , props : eventTargetProps } = eventTarget ;
154165 if ( eventTargetType === COMPONENT_TYPE ) {
155- payload = dispatchPayloads [ dispatchType ] ;
156- if ( process . env . NODE_ENV !== 'production' ) {
157- sendDebugMessage ( {
158- key : functionKey ,
159- eventType : constants . DEBUG_MSG_FUNCTION_FIRE_EVENT ,
160- eventName : dispatchType ,
161- outputData : payload ,
162- functionName : functionName ,
163- timestamp : Date . now ( ) ,
164- } ) ;
165- }
166166 dispatchToComponent ( eventTargetProps , payload , dispatch , helpers ) ;
167167 }
168168 } ) ;
169169 if ( innerTasks [ dispatchType ] && innerTasks [ dispatchType ] . length > 0 ) {
170- payload = dispatchPayloads [ dispatchType ] ;
171- if ( process . env . NODE_ENV !== 'production' ) {
172- sendDebugMessage ( {
173- key : functionKey ,
174- eventType : constants . DEBUG_MSG_FUNCTION_FIRE_EVENT ,
175- eventName : dispatchType ,
176- outputData : payload ,
177- functionName : functionName ,
178- timestamp : Date . now ( ) ,
179- } ) ;
180- }
181170 innerTasks [ dispatchType ] . forEach ( task => {
182171 const { func } = task ;
183172 func . apply ( null , [ payload ] ) ( dispatch , getState , helpers ) ;
@@ -229,7 +218,7 @@ function createTasks (targets) {
229218 innerTasks ,
230219 functionKey ,
231220 functionName ,
232- { [ DISPATCH_ERROR_TYPE ] : error ? error . message : null } ,
221+ { [ DISPATCH_ERROR_TYPE ] : error } ,
233222 dispatch ,
234223 getState ,
235224 helpers
0 commit comments