From 263e4e77bf1f38811e096a39bf423631e2a7a238 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Tue, 25 Mar 2025 17:28:21 -0400 Subject: [PATCH] refactor: initialize layout when token is available --- cmd/app.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/app.go b/cmd/app.go index b03d05b..d02c84f 100644 --- a/cmd/app.go +++ b/cmd/app.go @@ -14,7 +14,8 @@ import ( type App struct { *tview.Application - cfg *config.Config + cfg *config.Config + flex *tview.Flex guildsTree *GuildsTree messagesText *MessagesText @@ -26,15 +27,14 @@ func newApp(cfg *config.Config) *App { a := &App{ Application: app, - cfg: cfg, - flex: tview.NewFlex(), + cfg: cfg, + flex: tview.NewFlex(), guildsTree: newGuildsTree(app, cfg), messagesText: newMessagesText(app, cfg), messageInput: newMessageInput(app, cfg), } - a.init() a.EnableMouse(cfg.Mouse) a.SetInputCapture(a.onInputCapture) a.flex.SetInputCapture(a.onFlexInputCapture) @@ -56,6 +56,7 @@ func (app *App) show(token string) error { return err } + app.init() app.SetRoot(app.flex, true) }