问题是调度的动作没有按顺序执行。下面是我的代码。 请建议需要进行哪些更改以使分派的动作按顺序执行
@Effect()
NTSPrintOrder$: Observable<any> = this.actions$.pipe(
ofType(listOrderActions.NTSPrintAll),
withLatestFrom(this.store$.select(state => state['listorder'])),
mergeMap(([action, listOrderState]: any) => {
let obs =[];
var orders = listOrderState.listOrders.filter(x => x.selected)
orders.forEach(order => {
obs.push(listOrderActions.editOrder({'payload': {order_number : order.order_number}}))
obs.push(listOrderActions.loadNTSDocument())
});
obs.push(listOrderActions.printNTSDocument())
return obs;
})
)
}
答案 0 :(得分:0)
您应仅在editOrder
内分派NTSPrintAll
。然后editOrder
的效果将调度loadNTSDocument
,loadNTSDocument
的效果将调度printNTSDocument
。