fix: selecting repo

Ayman Bagabas created

Change summary

ui/pages/selection/selection.go | 6 +-----
ui/ui.go                        | 4 ++--
2 files changed, 3 insertions(+), 7 deletions(-)

Detailed changes

ui/pages/selection/selection.go 🔗

@@ -271,11 +271,7 @@ func (s *Selection) View() string {
 }
 
 func (s *Selection) changeActive(msg selector.ActiveMsg) tea.Cmd {
-	cfg := s.s.Config()
-	r, err := cfg.Source.GetRepo(msg.ID())
-	if err != nil {
-		return common.ErrorCmd(err)
-	}
+	r := msg.IdentifiableItem.(Item).repo
 	rm, rp := r.Readme()
 	return s.readme.SetContent(rm, rp)
 }

ui/ui.go 🔗

@@ -232,7 +232,7 @@ func (ui *UI) setRepoCmd(rn string) tea.Cmd {
 	rs := ui.s.Source()
 	return func() tea.Msg {
 		for _, r := range rs.AllRepos() {
-			if r.Name() == rn {
+			if r.Repo() == rn {
 				ui.activePage = repoPage
 				return repo.RepoMsg(r)
 			}
@@ -245,7 +245,7 @@ func (ui *UI) initialRepoCmd(rn string) tea.Cmd {
 	rs := ui.s.Source()
 	return func() tea.Msg {
 		for _, r := range rs.AllRepos() {
-			if r.Name() == rn {
+			if r.Repo() == rn {
 				ui.activePage = repoPage
 				return repo.RepoMsg(r)
 			}