Skip to content

Commit

Permalink
Fix selected index when event added
Browse files Browse the repository at this point in the history
  • Loading branch information
akiomik committed Dec 30, 2023
1 parent 1bced60 commit 34f3443
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ impl Component for Home {
fn update(&mut self, action: Action) -> Result<Option<Action>> {
match action {
Action::ReceiveEvent(ev) => match ev.kind {
Kind::TextNote => self.notes.push_front(ev),
Kind::TextNote => {
self.notes.push_front(ev);
let selection = self.list_state.selected().map(|i| i + 1);
self.list_state.select(selection);
}
Kind::Reaction => self.append_reaction(ev),
Kind::Repost => self.append_repost(ev), // TODO: show reposts on feed
Kind::ZapReceipt => self.append_zap_receipt(ev),
Expand Down

0 comments on commit 34f3443

Please sign in to comment.