1

同事们,我不能让diode自己从另一个动作中发送一个以上的动作。这里的例子来自App circuit

val handler = new ActionHandler(myZoomedState) {
    override def handle = {
      case action => effectOnly(Effect(someFuture map {_ =>
        someAction  //This action doesn't perform 
        someOtherAction  //This one does
      }))

      case someAction => ???
      case someOtherAction => ???
    }
}

如何链接我的行动?像这样的>>东西callbacks
someCallback >> someOtherCallback

4

2 回答 2

0

奥列格,你的问题还不清楚。如果您的someAction和的处理程序someOtherAction实际上仅按照您的case action建议执行,您可以将它们移动到命名方法中并使用<<or>>+组合它们。如果这不是您想要的,您应该更详细地阐述您的问题。

于 2018-02-12T18:54:56.510 回答
0

解决方案是创建另一个动作,将这两个动作结合起来。我仍然可以处理Future错误。看起来像这样:

case object DoSmthStuff
...

val handler = new ActionHandler(myZoomedState) {
    override def handle = {
      case action => effectOnly(Effect(
          someFuture map { _ => DoSmthStuff } recover { ... }
      ))

      case DoSmthStuff = effectOnly(
          Effect.action(someAction) >> Effect.action(someOtherAction)
      )

      case someAction => ???
      case someOtherAction => ???
    }
}
于 2018-02-13T06:31:04.743 回答