From 3db817b684270bdae39cb811be41f3386acfb242 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 27 Apr 2023 10:55:26 -0400 Subject: [PATCH] fix(ui): empty repo resize regression --- ui/pages/repo/files.go | 3 +-- ui/pages/repo/log.go | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ui/pages/repo/files.go b/ui/pages/repo/files.go index f519c5586..831abec2a 100644 --- a/ui/pages/repo/files.go +++ b/ui/pages/repo/files.go @@ -332,8 +332,7 @@ func (f *Files) updateFilesCmd() tea.Msg { files := make([]selector.IdentifiableItem, 0) dirs := make([]selector.IdentifiableItem, 0) if f.ref == nil { - log.Printf("ui: files: ref is nil") - return common.ErrorMsg(errNoRef) + return nil } r, err := f.repo.Open() if err != nil { diff --git a/ui/pages/repo/log.go b/ui/pages/repo/log.go index 30bac3f73..9e15fc389 100644 --- a/ui/pages/repo/log.go +++ b/ui/pages/repo/log.go @@ -290,7 +290,7 @@ func (l *Log) Update(msg tea.Msg) (tea.Model, tea.Cmd) { ), ) } - if l.repo != nil { + if l.repo != nil && l.ref != nil { cmds = append(cmds, l.updateCommitsCmd, // start loading on resize since the number of commits per page @@ -385,8 +385,7 @@ func (l *Log) StatusBarInfo() string { func (l *Log) countCommitsCmd() tea.Msg { if l.ref == nil { - logger.Debugf("ui: log: ref is nil") - return common.ErrorMsg(errNoRef) + return nil } r, err := l.repo.Open() if err != nil { @@ -411,8 +410,7 @@ func (l *Log) updateCommitsCmd() tea.Msg { } } if l.ref == nil { - logger.Debugf("ui: log: ref is nil") - return common.ErrorMsg(errNoRef) + return nil } items := make([]selector.IdentifiableItem, count) page := l.nextPage