summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/core.go
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2024-12-21 18:29:29 +0200
committerKyren223 <Kyren223@proton.me>2024-12-21 18:29:29 +0200
commite88c5f242dbb30f5fc7a9dfb581fa519d2e5ff11 (patch)
treeecfeab1db33922fe115b88b2b8e57efb28f40493 /internal/client/ui/core/core.go
parent3c35c3dbfab1ed6ee2e193f881fad4ed5754d0c0 (diff)
Implemented fetching existing messages when changing frequencies
Diffstat (limited to 'internal/client/ui/core/core.go')
-rw-r--r--internal/client/ui/core/core.go27
1 files changed, 15 insertions, 12 deletions
diff --git a/internal/client/ui/core/core.go b/internal/client/ui/core/core.go
index f986351..b1ed7e3 100644
--- a/internal/client/ui/core/core.go
+++ b/internal/client/ui/core/core.go
@@ -308,19 +308,22 @@ func (m *Model) updateConnected(msg tea.Msg) tea.Cmd {
return nil
}
+ var cmds []tea.Cmd
var cmd tea.Cmd
- switch m.focus {
- case FocusNetworkList:
- m.networkList, cmd = m.networkList.Update(msg)
- m.frequencyList.SetNetworkIndex(m.networkList.Index())
- m.chat.SetFrequency(m.networkList.Index(), m.frequencyList.Index())
- case FocusFrequencyList:
- m.frequencyList, cmd = m.frequencyList.Update(msg)
- m.chat.SetFrequency(m.networkList.Index(), m.frequencyList.Index())
- case FocusChat:
- m.chat, cmd = m.chat.Update(msg)
- }
- return cmd
+
+ m.networkList, cmd = m.networkList.Update(msg)
+ cmds = append(cmds, cmd)
+
+ m.frequencyList.SetNetworkIndex(m.networkList.Index())
+ m.frequencyList, cmd = m.frequencyList.Update(msg)
+ cmds = append(cmds, cmd)
+
+ cmd = m.chat.SetFrequency(m.networkList.Index(), m.frequencyList.Index())
+ cmds = append(cmds, cmd)
+ m.chat, cmd = m.chat.Update(msg)
+ cmds = append(cmds, cmd)
+
+ return tea.Batch(cmds...)
}
func (m *Model) updateLoadScreenContent() {