reset page

This commit is contained in:
abs3nt 2023-01-14 13:19:01 -08:00
parent d2dde8b690
commit e8ba2ea6f3

View File

@ -120,7 +120,6 @@ func (m *mainModel) GoBack() (tea.Cmd, error) {
fmt.Println(err.Error()) fmt.Println(err.Error())
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
case Album: case Album:
m.mode = Albums m.mode = Albums
m.list.NewStatusMessage("Setting view to albums") m.list.NewStatusMessage("Setting view to albums")
@ -130,8 +129,6 @@ func (m *mainModel) GoBack() (tea.Cmd, error) {
return nil, err return nil, err
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
m.list.ResetSelected()
case Artist: case Artist:
m.mode = Artists m.mode = Artists
m.list.NewStatusMessage("Setting view to artists") m.list.NewStatusMessage("Setting view to artists")
@ -140,8 +137,6 @@ func (m *mainModel) GoBack() (tea.Cmd, error) {
return nil, err return nil, err
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
m.list.ResetSelected()
case ArtistAlbum: case ArtistAlbum:
m.mode = Artist m.mode = Artist
m.list.NewStatusMessage("Opening " + m.artist.Name) m.list.NewStatusMessage("Opening " + m.artist.Name)
@ -150,8 +145,6 @@ func (m *mainModel) GoBack() (tea.Cmd, error) {
return nil, err return nil, err
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
m.list.ResetSelected()
case SearchArtists, SearchTracks, SearchAlbums, SearchPlaylists: case SearchArtists, SearchTracks, SearchAlbums, SearchPlaylists:
m.mode = Search m.mode = Search
m.list.NewStatusMessage("Setting view to search for " + m.input.Value()) m.list.NewStatusMessage("Setting view to search for " + m.input.Value())
@ -177,7 +170,6 @@ func (m *mainModel) GoBack() (tea.Cmd, error) {
return nil, err return nil, err
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
m.list.ResetSelected()
case SearchAlbum: case SearchAlbum:
m.mode = SearchAlbums m.mode = SearchAlbums
m.list.NewStatusMessage("Setting view to albums") m.list.NewStatusMessage("Setting view to albums")
@ -195,7 +187,6 @@ func (m *mainModel) GoBack() (tea.Cmd, error) {
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
default: default:
m.list.ResetSelected()
page = 0 page = 0
} }
return nil, nil return nil, nil
@ -496,6 +487,7 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
m.list.ResetSelected()
return m, msg return m, msg
} }