From 8efbd0b460fa068e92648c651ed757ac2cac83ff Mon Sep 17 00:00:00 2001 From: Joshua Rich Date: Tue, 26 Sep 2023 12:07:19 +0000 Subject: [PATCH] fix(agent): (hopefully) get some memory savings in sensors table display --- internal/agent/ui/fyneUI.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/agent/ui/fyneUI.go b/internal/agent/ui/fyneUI.go index 9e8b04a40..19861af43 100644 --- a/internal/agent/ui/fyneUI.go +++ b/internal/agent/ui/fyneUI.go @@ -205,7 +205,12 @@ func (ui *fyneUI) sensorsWindow(s Agent, t *translations.Translator) fyne.Window getValue := func(n string) string { if v, err := s.SensorValue(n); err == nil { - return fmt.Sprintf("%v %s", v.State(), v.Units()) + var b strings.Builder + fmt.Fprintf(&b, "%v", v.State()) + if v.Units() != "" { + fmt.Fprintf(&b, " %s", v.Units()) + } + return b.String() } return "" }