From 6c38ff92e78011f797eb34c94c531bcf347644de Mon Sep 17 00:00:00 2001 From: Ari Breitkreuz Date: Thu, 4 Jan 2024 14:43:28 +0100 Subject: [PATCH] Update dependencies --- Cargo.toml | 10 +++++----- src/lib.rs | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8b44852..3a468fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "frontest" -version = "0.2.0" +version = "0.3.0" edition = "2021" authors = ["Maciej ZwoliƄski "] repository = "https://github.com/zwo1in/frontest-rs" @@ -21,9 +21,9 @@ readme = "README.md" default = ["yew"] [dependencies] -gloo = { version = "0.6", features = ["futures"] } -wasm-bindgen = "0.2.79" -web-sys = { version = "0.3.56", features = [ +gloo = { version = "0.11", features = ["futures"] } +wasm-bindgen = "0.2.89" +web-sys = { version = "0.3", features = [ "Document", "Element", "HtmlElement", @@ -40,7 +40,7 @@ web-sys = { version = "0.3.56", features = [ "NodeList", ] } -yew = { version = "0.19", optional = true } +yew = { version = "0.21", optional = true, features = ["csr"] } [dev-dependencies] wasm-bindgen-test = "0.3" diff --git a/src/lib.rs b/src/lib.rs index cd9859c..5b775c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -269,7 +269,8 @@ pub mod yew { let div = gloo::utils::document().create_element("div").unwrap(); gloo::utils::body().append_child(&div).unwrap(); let res = div.clone(); - ::yew::start_app_with_props_in_element::(div, WrapperProps { content }); + ::yew::Renderer::::with_root_and_props(div, WrapperProps { content }).render(); + ::yew::platform::time::sleep(std::time::Duration::ZERO).await; res } @@ -307,6 +308,8 @@ pub mod yew { assert_eq!("Value: 0", value.inner_text()); button.click(); + // Events are handled when the scheduler is yielded. So we need to add this after any interaction with the DOM. + ::yew::platform::time::sleep(std::time::Duration::ZERO).await; assert_eq!("Value: 1", value.inner_text()); body().remove_child(&mount).unwrap();