Skip to content

Commit

Permalink
fix feed refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
treethought committed Jun 10, 2024
1 parent a7b1d0c commit 7b3078d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func (a *App) SetFocus(name string) tea.Cmd {
a.focusedModel = m
a.focused = name
a.sidebar.SetActive(false)
return nil
return m.Init()
}

Expand Down Expand Up @@ -268,14 +269,19 @@ func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.splash.SetInfo(msg.channel.Name)
case *api.FeedResponse:
// allow msg to pass through to profile's embedded feed
fm := a.GetFocused()
if a.focused == "profile" {
_, cmd := a.GetFocused().Update(msg)
if p, ok := fm.(*Profile); ok {
p.feed.Clear()
}
_, cmd := fm.Update(msg)
return a, cmd
}
feed := a.GetModel("feed").(*FeedView)
if a.focused == "feed" {
feed.Clear()
if a.focused == "feed" && a.prev == "feed" {
return a, nil
}
feed := a.GetModel("feed").(*FeedView)
feed.Clear()
focusCmd := a.SetFocus("feed")
a.splash.SetInfo("loading channels...")
return a, tea.Batch(feed.setItems(msg.Casts), focusCmd)
Expand Down Expand Up @@ -358,7 +364,7 @@ func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

case *currentAccountMsg:
_, cmd := a.sidebar.Update(msg)
a.splash.ShowSignin(false)
a.splash.ShowSignin(false)
return a, cmd
}
if a.publish.Active() {
Expand Down

0 comments on commit 7b3078d

Please sign in to comment.