Fix mounted event after initial hydration (#3480)
* trigger queued mounted events immediately after hydrating * add a playwright test to prevent regressions
This commit is contained in:
1 parent
d41ab3a756
commit
d890cc72ac
8 files changed
+76
-1
No files matched your search
@@ -0,0 +1,17 @@
|
||||
[package]
|
||||
name = "dioxus-playwright-fullstack-mounted-test"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dioxus = { workspace = true, features = ["fullstack"] }
|
||||
serde = "1.0.159"
|
||||
tokio = { workspace = true, features = ["full"], optional = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
server = ["dioxus/server", "dep:tokio"]
|
||||
web = ["dioxus/web"]
|
||||
@@ -0,0 +1,23 @@
|
||||
// Regression test for https://github.com/DioxusLabs/dioxus/pull/3480
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus::launch(App);
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn App() -> Element {
|
||||
let mut mounted = use_signal(|| false);
|
||||
|
||||
rsx! {
|
||||
div {
|
||||
onmounted: move |_| {
|
||||
mounted.set(true);
|
||||
},
|
||||
if mounted() {
|
||||
"The mounted event was triggered."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user