fix reload issue

This commit is contained in:
Yuki Osaki 2022-08-19 13:07:10 +09:00
parent 93bbea1221
commit b5578b3816
2 changed files with 21 additions and 6 deletions

View file

@ -24,14 +24,23 @@ func (gui *Gui) branchesRenderToMain() error {
})
}
func (gui *Gui) refreshGithubPullRequests() {
func (gui *Gui) refreshGithubPullRequests() error {
if err := gui.git.Gh.BaseRepo(); err == nil {
_ = gui.setGithubPullRequests()
return
err := gui.setGithubPullRequests()
if err != nil {
return err
}
gui.refreshBranches()
return nil
}
// when config not exits
_ = gui.refreshRemotes()
err := gui.refreshRemotes()
if err != nil {
return err
}
_ = gui.c.Prompt(types.PromptOpts{
Title: gui.c.Tr.SelectRemoteRepository,
@ -48,11 +57,13 @@ func (gui *Gui) refreshGithubPullRequests() {
if err != nil {
return err
}
_ = gui.postRefreshUpdate(gui.State.Contexts.Branches)
gui.refreshBranches()
return nil
})
},
})
return nil
}
func (gui *Gui) setGithubPullRequests() error {

View file

@ -238,7 +238,11 @@ func (gui *Gui) refreshCommitsWithLimit() error {
gui.State.Model.Commits = commits
if gui.Config.GetUserConfig().Git.EnableGhCommand {
gui.refreshGithubPullRequests()
err = gui.refreshGithubPullRequests()
if err != nil {
return err
}
}
return gui.c.PostRefreshUpdate(gui.State.Contexts.LocalCommits)