Skip to content

Commit

Permalink
Scroll to top when list have searched. (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee authored Jul 24, 2024
1 parent 764e748 commit d60a112
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/ui/src/list/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,15 @@ where

self._search_task = cx.spawn(|this, mut cx| async move {
search.await;

let _ = this.update(&mut cx, |this, _| {
this.vertical_scroll_handle.scroll_to_item(0);
this.last_query = Some(text);
});

// Always wait 100ms to avoid flicker
Timer::after(Duration::from_millis(100)).await;
let _ = this.update(&mut cx, |this, cx| {
this.last_query = Some(text);
this.set_loading(false, cx);
});
});
Expand Down

0 comments on commit d60a112

Please sign in to comment.