Access cell in event handlers

This commit is contained in:
2026-01-31 14:19:37 +01:00
parent 17f78b86f4
commit ec320e47fd
2 changed files with 48 additions and 34 deletions
+3 -2
View File
@@ -192,7 +192,7 @@ pub fn use_sync_state<
pub fn use_sync_effect<
T: Send + Sync + 'static,
Ev: 'static,
Ev: Send + Sync + 'static,
E: Fn(&State<T>) -> Ev + Send + Sync + 'static,
>(
cx: &Arc<Context>,
@@ -205,7 +205,8 @@ pub fn use_sync_effect<
let state = state.clone();
let cx = cx.clone();
move || {
cx.emit_event(&encoder(&state));
let ev = encoder(&state);
cx.emit_event(ev);
}
},
deps,