NGRX效果-调度的动作未按顺序执行

问题描述 投票:1回答:1

问题是,未按顺序执行已分派的动作。下面是我的代码。请建议需要进行哪些更改以使分派的动作按顺序执行

@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;
    })
  )
}
angular ngrx ngrx-effects
1个回答
0
投票

您只能在editOrder之内发送NTSPrintAll。然后,editOrder的效果将分派loadNTSDocumentloadNTSDocument的效果将分派printNTSDocument

© www.soinside.com 2019 - 2024. All rights reserved.