Pause spinner ticks when not refreshing.
All checks were successful
Build & Test / Main (push) Successful in 59s
All checks were successful
Build & Test / Main (push) Successful in 59s
Also, add a quick-and-dirty model for displaying basic performance stats, currently just the number of calls to the root Update() and View() methods.
This commit is contained in:
@@ -108,11 +108,16 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
|
||||
switch msg := msg.inner.(type) {
|
||||
case refresh:
|
||||
m.refreshing = true
|
||||
return m, func() tea.Msg {
|
||||
// TODO: log errors
|
||||
_ = m.math.Refresh(context.TODO())
|
||||
return Msg{m.math.Asset, m.math}
|
||||
}
|
||||
return m, tea.Batch(
|
||||
func() tea.Msg {
|
||||
return m.indicator.Tick()
|
||||
},
|
||||
func() tea.Msg {
|
||||
// TODO: log errors
|
||||
_ = m.math.Refresh(context.TODO())
|
||||
return Msg{m.math.Asset, m.math}
|
||||
},
|
||||
)
|
||||
case moon.Math:
|
||||
m.math = msg
|
||||
refillProperties(&m)
|
||||
@@ -135,6 +140,9 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
|
||||
return m, nil
|
||||
}
|
||||
case spinner.TickMsg:
|
||||
if !m.refreshing {
|
||||
return m, nil
|
||||
}
|
||||
var cmd tea.Cmd
|
||||
m.indicator, cmd = m.indicator.Update(msg)
|
||||
return m, cmd
|
||||
|
Reference in New Issue
Block a user