Skip to content

Commit

Permalink
fix(ui): empty repo resize regression
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed May 2, 2023
1 parent 0b842d7 commit 3db817b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions ui/pages/repo/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 3 additions & 5 deletions ui/pages/repo/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 3db817b

Please sign in to comment.