Fixed refresh

This commit is contained in:
2026-01-24 16:01:22 +01:00
parent 33370287b2
commit 02f3aea4e3
2 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -29,8 +29,11 @@ fn app(cx: &Arc<Context>) -> View {
let count = count.clone();
move |_cx, _event: &KeyPress| {
let mut count = count.get();
if *count > 5 {
_cx.refresh();
return;
}
*count += 1;
cx.refresh();
}
});
+2
View File
@@ -35,6 +35,8 @@ impl Context {
}
pub fn refresh(self: &Arc<Context>) {
self.event_handlers.lock().unwrap().clear();
let c = self.component.lock().unwrap().clone();
*self.view.lock().unwrap() = (c)(self);
}