File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
packages/node_modules/overmind/src Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -968,16 +968,22 @@ export function forEach<
968968 }
969969 startDebugOperator ( 'forEach' , '' , context )
970970
971- array . forEach ( ( value , index ) => {
972- lastContext = createContext (
973- lastContext || context ,
974- value ,
975- context . execution . path && context . execution . path . concat ( String ( index ) )
976- )
977- const nextWithPath = createNextPath ( evaluate )
978- // @ts -ignore
979- forEachItemOperator ( null , lastContext , nextWithPath )
980- } )
971+ if ( array . length ) {
972+ array . forEach ( ( value , index ) => {
973+ lastContext = createContext (
974+ lastContext || context ,
975+ value ,
976+ context . execution . path &&
977+ context . execution . path . concat ( String ( index ) )
978+ )
979+ const nextWithPath = createNextPath ( evaluate )
980+ // @ts -ignore
981+ forEachItemOperator ( null , lastContext , nextWithPath )
982+ } )
983+ } else {
984+ stopDebugOperator ( context , context . value )
985+ next ( null , createContext ( context , context . value ) )
986+ }
981987 }
982988 }
983989 instance [ IS_OPERATOR ] = true
You can’t perform that action at this time.
0 commit comments