fix: draw msgs only when the channel is in cache

This commit is contained in:
ayn2op 2025-05-01 21:56:36 -04:00
parent 8f4667dc5f
commit 79923f98dc

View file

@ -190,18 +190,17 @@ func (gt *GuildsTree) onSelected(n *tview.TreeNode) {
gt.createChannelNodes(n, cs)
case discord.ChannelID:
app.messagesText.drawMsgs(ref)
app.messagesText.ScrollToEnd()
c, err := discordState.Cabinet.Channel(ref)
if err != nil {
slog.Error("failed to get channel", "channel_id", ref)
return
}
app.messagesText.drawMsgs(c.ID)
app.messagesText.ScrollToEnd()
app.messagesText.SetTitle(gt.channelToString(*c))
gt.selectedChannelID = ref
gt.selectedChannelID = c.ID
gt.app.SetFocus(app.messageInput)
case nil: // Direct messages
cs, err := discordState.PrivateChannels()