Skip to content

Commit 21eecd5

Browse files
authored
fix: send batch commands to cmds channel instead of executing them in event loop (#1473)
We shouldn't execute commands in the event loop ourselves. Instead, we should send them to the commands channel where the command handlers will take care of executing them. Fixes: f5da8d0 (fix: handle nested SequenceMsg in event loop and use sync.WaitGroup f… (#1463)) Supersedes: #1485
1 parent 9aae1f0 commit 21eecd5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tea.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,11 @@ func (p *Program) eventLoop(model Model, cmds chan Cmd) (Model, error) {
475475
if cmd == nil {
476476
continue
477477
}
478-
go p.Send(cmd())
478+
select {
479+
case <-p.ctx.Done():
480+
return model, nil
481+
case cmds <- cmd:
482+
}
479483
}
480484
continue
481485

0 commit comments

Comments
 (0)