Refactored some variable assignments

This commit is contained in:
strNophix 2022-03-21 18:24:24 +01:00
parent 46883cc42d
commit ebf5f5f970
2 changed files with 5 additions and 7 deletions

View File

@ -63,9 +63,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.trackPlayer.play(t.getReader()) m.trackPlayer.play(t.getReader())
} }
} }
var cmd tea.Cmd
tpv, cmd := m.trackPlayerView.Update(msg) m.trackPlayerView, cmd = m.trackPlayerView.Update(msg)
m.trackPlayerView = tpv
cmds = append(cmds, cmd) cmds = append(cmds, cmd)
return m, tea.Batch(cmds...) return m, tea.Batch(cmds...)

View File

@ -41,12 +41,11 @@ func (v trackPlayerView) Update(msg tea.Msg) (trackPlayerView, tea.Cmd) {
v.trackList.SetWidth(msg.Width) v.trackList.SetWidth(msg.Width)
} }
tl, cmd := v.trackList.Update(msg) var cmd tea.Cmd
v.trackList = tl v.trackList, cmd = v.trackList.Update(msg)
cmds = append(cmds, cmd) cmds = append(cmds, cmd)
sb, cmd := v.statusBar.Update(msg) v.statusBar, cmd = v.statusBar.Update(msg)
v.statusBar = sb
cmds = append(cmds, cmd) cmds = append(cmds, cmd)
return v, tea.Batch(cmds...) return v, tea.Batch(cmds...)