Cmd.batch does not make any guarantee about the order of execution. It is use to bundle a batch of commands in one entity.
If you need order of execution, you need to use something lower level, like Tasks where you have `andThen`. On Thu, Oct 13, 2016 at 9:59 PM, David Andrews <[email protected]> wrote: > When using Cmd.batch to send data over two ports, the ports receive the > events in the same order regardless of the order in which they appear in > the batch. I would expect the events to occur in the order they appear in > the batch. > > Working example: https://daviddta.github.io/elm-port-order-bug/ > Code: https://github.com/DavidDTA/elm-port-order-bug > Looking at the console, we see that port one always receives the event > before port two. > > As some motivation, consider two ports which both write to the same local > storage key. Without a guarantee on the ordering of events, the two > subscriptions will race to write the key. > > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- There is NO FATE, we are the creators. blog: http://damoc.ro/ -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
