From 02f3aea4e384ef1ad1476d8360ed271a4aeded35 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sat, 24 Jan 2026 16:01:22 +0100 Subject: [PATCH] Fixed refresh --- examples/hello_world.rs | 5 ++++- src/component.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/hello_world.rs b/examples/hello_world.rs index bc9d0dc..d50f1cf 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -29,8 +29,11 @@ fn app(cx: &Arc) -> View { let count = count.clone(); move |_cx, _event: &KeyPress| { let mut count = count.get(); + if *count > 5 { + _cx.refresh(); + return; + } *count += 1; - cx.refresh(); } }); diff --git a/src/component.rs b/src/component.rs index 2d8bccf..6da4dc2 100644 --- a/src/component.rs +++ b/src/component.rs @@ -35,6 +35,8 @@ impl Context { } pub fn refresh(self: &Arc) { + self.event_handlers.lock().unwrap().clear(); + let c = self.component.lock().unwrap().clone(); *self.view.lock().unwrap() = (c)(self); }