From cbe309d6241c623523b193c60c1473dc5517fca3 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Sun, 16 Oct 2022 17:02:00 +0200 Subject: [PATCH] fix: don't delay messages behind a long command --- tea.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tea.go b/tea.go index d6ba73c..d6a19d5 100644 --- a/tea.go +++ b/tea.go @@ -249,7 +249,10 @@ func (p *Program) handleCommands(cmds chan Cmd) chan struct{} { // (e.g. tick commands that sleep for half a second). It's not // possible to cancel them so we'll have to leak the goroutine // until Cmd returns. - go p.Send(cmd()) + go func() { + msg := cmd() // this can be long. + p.Send(msg) + }() } } }()