Don't do command batching if the batch is 0 items long

This commit is contained in:
Christian Rocha 2020-04-01 12:05:05 -04:00
parent 1bf93b1ccf
commit 2e509ad32c
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 3 additions and 0 deletions

3
tea.go
View File

@ -28,6 +28,9 @@ func CmdMap(cmd Cmd, model Model) Cmd {
// Batch peforms a bunch of commands concurrently with no ordering guarantees
// about the results.
func Batch(cmds ...Cmd) Cmd {
if len(cmds) == 0 {
return nil
}
return func(_ Model) Msg {
return batchMsg(cmds)
}