chore: add some fixes to hot reload

This commit is contained in:
Jonathan Kelley committed 2022-12-25 23:22:43 -05:00
1 parent 079d71fb2b
commit 366e46eddf
4 files changed
+34 -19

No files matched your search

+8 -1
View File
@@ -55,6 +55,9 @@ pub struct LinkProps<'a> {
/// Pass children into the `<a>` element
pub children: Element<'a>,
/// The onclick event handler.
pub onclick: Option<EventHandler<'a, MouseEvent>>,
}
/// A component that renders a link to a route.
@@ -119,7 +122,7 @@ pub fn Link<'a>(cx: Scope<'a, LinkProps<'a>>) -> Element {
title: format_args!("{}", title.unwrap_or("")),
prevent_default: "{prevent_default}",
target: format_args!("{}", if * new_tab { "_blank" } else { "" }),
onclick: move |_| {
onclick: move |evt| {
log::trace!("Clicked link to {}", to);
if !outerlink {
@@ -138,6 +141,10 @@ pub fn Link<'a>(cx: Scope<'a, LinkProps<'a>>) -> Element {
);
}
}
if let Some(onclick) = cx.props.onclick.as_ref() {
onclick.call(evt);
}
},
children
}