mirror of
https://github.com/leptos-rs/leptos
synced 2024-09-20 22:41:59 +00:00
Merge pull request #208 from jquesada2016/207
fixes compiler recursion limit on `View::on`
This commit is contained in:
commit
795270447b
1 changed files with 9 additions and 1 deletions
|
@ -544,6 +544,14 @@ impl View {
|
|||
self,
|
||||
event: E,
|
||||
event_handler: impl FnMut(E::EventType) + 'static,
|
||||
) -> Self {
|
||||
self.on_impl(event, Box::new(event_handler))
|
||||
}
|
||||
|
||||
fn on_impl<E: ev::EventDescriptor + 'static>(
|
||||
self,
|
||||
event: E,
|
||||
event_handler: Box<dyn FnMut(E::EventType)>,
|
||||
) -> Self {
|
||||
cfg_if! {
|
||||
if #[cfg(all(target_arch = "wasm32", feature = "web"))] {
|
||||
|
@ -565,7 +573,7 @@ impl View {
|
|||
c.children.iter().cloned().for_each(|c| {
|
||||
let event_handler = event_handler.clone();
|
||||
|
||||
c.on(event.clone(), move |e| event_handler.borrow_mut()(e));
|
||||
c.on(event.clone(), Box::new(move |e| event_handler.borrow_mut()(e)));
|
||||
});
|
||||
}
|
||||
Self::CoreComponent(c) => match c {
|
||||
|
|
Loading…
Reference in a new issue