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:
Evan Almloff authored and GitHub committed 2024-12-17 15:21:15 -08:00
1 parent 01c5716128
commit c0e01f99af
8 files changed
+126 -38

No files matched your search

@@ -40,6 +40,21 @@ fn app() -> Element {
id: "errors",
Errors {}
}
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"
}
}
}