chore: refactor the input component (#165)

* refactor the input component

* fix clippy

* clean up
This commit is contained in:
reya
2025-09-25 08:03:14 +07:00
committed by GitHub
parent a87184214f
commit 61cad5dd96
20 changed files with 2529 additions and 1593 deletions

View File

@@ -299,14 +299,16 @@ where
fn on_query_input_event(
&mut self,
_: &Entity<InputState>,
state: &Entity<InputState>,
event: &InputEvent,
window: &mut Window,
cx: &mut Context<Self>,
) {
match event {
InputEvent::Change(text) => {
InputEvent::Change => {
let text = state.read(cx).value();
let text = text.trim().to_string();
if Some(&text) == self.last_query.as_ref() {
return;
}
@@ -347,7 +349,7 @@ where
}
}
fn set_querying(&mut self, querying: bool, _: &mut Window, cx: &mut Context<Self>) {
fn set_querying(&mut self, querying: bool, _window: &mut Window, cx: &mut Context<Self>) {
self.querying = querying;
if let Some(input) = &self.query_input {
input.update(cx, |input, cx| input.set_loading(querying, cx))