Fix onmounted event triggering many times (#3346)
* Fix event handler diffing * Add headless tests for the onmounted event * fix typo triggerd -> triggered
This commit is contained in:
1 parent
01c5716128
commit
c0e01f99af
8 files changed
+126
-38
No files matched your search
@@ -20,6 +20,21 @@ fn app() -> Element {
|
||||
}
|
||||
input { value: "hello input" }
|
||||
div { class: "style-div", color: "red", "colored text" }
|
||||
OnMounted {}
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn OnMounted() -> Element {
|
||||
let mut mounted_triggered_count = use_signal(|| 0);
|
||||
rsx! {
|
||||
div {
|
||||
class: "onmounted-div",
|
||||
onmounted: move |_| {
|
||||
mounted_triggered_count += 1;
|
||||
},
|
||||
"onmounted was called {mounted_triggered_count} times"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user