diff --git a/examples/hydration.rs b/examples/hydration.rs index ed43a9f70..88b32bb11 100644 --- a/examples/hydration.rs +++ b/examples/hydration.rs @@ -13,7 +13,8 @@ use dioxus::prelude::*; use dioxus_desktop::Config; fn main() { - let vdom = VirtualDom::new(app); + let mut vdom = VirtualDom::new(app); + let _ = vdom.rebuild(); let content = dioxus_ssr::pre_render(&vdom); dioxus_desktop::launch_cfg(app, Config::new().with_prerendered(content)); diff --git a/examples/read_size.rs b/examples/read_size.rs index 806f71f80..20635eeab 100644 --- a/examples/read_size.rs +++ b/examples/read_size.rs @@ -48,7 +48,7 @@ fn app(cx: Scope) -> Element { let read = div_element.read(); let client_rect = read.as_ref().map(|el| el.get_client_rect()); if let Some(client_rect) = client_rect { - if let Ok(rect) = client_rect.await { + if let Ok(rect) = dbg!(client_rect.await) { dimentions.set(rect); } } diff --git a/examples/suspense.rs b/examples/suspense.rs index dbdad2eba..40be30cd0 100644 --- a/examples/suspense.rs +++ b/examples/suspense.rs @@ -10,7 +10,7 @@ //! will cause it to fetch a random dog image from the Dog API. Since the data //! is not ready immediately, we render some loading text. //! -//! We can achieve the majoirty of suspense functionality by composing "suspenseful" +//! We can achieve the majority of suspense functionality by composing "suspenseful" //! primitives in our own custom components. use dioxus::prelude::*; diff --git a/packages/desktop/src/query.rs b/packages/desktop/src/query.rs index ca034293a..247f333e8 100644 --- a/packages/desktop/src/query.rs +++ b/packages/desktop/src/query.rs @@ -168,10 +168,8 @@ pub(crate) struct Query { impl Query { /// Resolve the query pub async fn resolve(mut self) -> Result { - match self.receiver.recv().await { - Some(result) => V::deserialize(result).map_err(QueryError::Deserialize), - None => Err(QueryError::Recv(RecvError::Closed)), - } + let result = self.result().await?; + V::deserialize(result).map_err(QueryError::Deserialize) } /// Send a message to the query diff --git a/packages/fullstack/examples/axum-desktop/src/client.rs b/packages/fullstack/examples/axum-desktop/src/client.rs index 938fe9ac9..bbd649b07 100644 --- a/packages/fullstack/examples/axum-desktop/src/client.rs +++ b/packages/fullstack/examples/axum-desktop/src/client.rs @@ -8,6 +8,6 @@ use dioxus_fullstack::prelude::server_fn::set_server_url; fn main() { // Set the url of the server where server functions are hosted. - set_server_url("http://127.0.0.0:8080"); + set_server_url("http://127.0.0.1:8080"); dioxus_desktop::launch(app) } diff --git a/packages/fullstack/examples/axum-desktop/src/server.rs b/packages/fullstack/examples/axum-desktop/src/server.rs index f4a9520f4..a8c61d28c 100644 --- a/packages/fullstack/examples/axum-desktop/src/server.rs +++ b/packages/fullstack/examples/axum-desktop/src/server.rs @@ -3,11 +3,16 @@ // cargo run --bin server --features ssr // ``` +use axum_desktop::*; use dioxus_fullstack::prelude::*; #[tokio::main] async fn main() { let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 8080)); + + PostServerData::register_explicit(); + GetServerData::register_explicit(); + axum::Server::bind(&addr) .serve( axum::Router::new() diff --git a/packages/fullstack/examples/axum-hello-world/src/main.rs b/packages/fullstack/examples/axum-hello-world/src/main.rs index a5724f8ee..ccba37396 100644 --- a/packages/fullstack/examples/axum-hello-world/src/main.rs +++ b/packages/fullstack/examples/axum-hello-world/src/main.rs @@ -1,8 +1,8 @@ //! Run with: //! //! ```sh -//! dx build --features web -//! cargo run --features ssr +//! dx build --features web --release +//! cargo run --features ssr --release //! ``` #![allow(non_snake_case, unused)] diff --git a/packages/fullstack/examples/axum-router/src/main.rs b/packages/fullstack/examples/axum-router/src/main.rs index c844b7924..b9ad1e057 100644 --- a/packages/fullstack/examples/axum-router/src/main.rs +++ b/packages/fullstack/examples/axum-router/src/main.rs @@ -1,8 +1,8 @@ //! Run with: //! //! ```sh -//! dx build --features web -//! cargo run --features ssr +//! dx build --features web --release +//! cargo run --features ssr --release //! ``` #![allow(non_snake_case)] diff --git a/packages/fullstack/examples/salvo-hello-world/src/main.rs b/packages/fullstack/examples/salvo-hello-world/src/main.rs index 09c68e1f4..cc3288563 100644 --- a/packages/fullstack/examples/salvo-hello-world/src/main.rs +++ b/packages/fullstack/examples/salvo-hello-world/src/main.rs @@ -1,8 +1,8 @@ //! Run with: //! //! ```sh -//! dx build --features web -//! cargo run --features ssr +//! dx build --features web --release +//! cargo run --features ssr --release //! ``` #![allow(non_snake_case, unused)] diff --git a/packages/fullstack/examples/static-hydrated/src/main.rs b/packages/fullstack/examples/static-hydrated/src/main.rs index 9edd0b5dc..78963be7e 100644 --- a/packages/fullstack/examples/static-hydrated/src/main.rs +++ b/packages/fullstack/examples/static-hydrated/src/main.rs @@ -1,7 +1,7 @@ //! Run with: //! //! ```sh -//! dx build --features web +//! dx build --features web --release //! cargo run --features ssr //! ``` diff --git a/packages/fullstack/examples/warp-hello-world/src/main.rs b/packages/fullstack/examples/warp-hello-world/src/main.rs index 09c68e1f4..cc3288563 100644 --- a/packages/fullstack/examples/warp-hello-world/src/main.rs +++ b/packages/fullstack/examples/warp-hello-world/src/main.rs @@ -1,8 +1,8 @@ //! Run with: //! //! ```sh -//! dx build --features web -//! cargo run --features ssr +//! dx build --features web --release +//! cargo run --features ssr --release //! ``` #![allow(non_snake_case, unused)] diff --git a/packages/rink/src/lib.rs b/packages/rink/src/lib.rs index 88f04450d..81ab45a85 100644 --- a/packages/rink/src/lib.rs +++ b/packages/rink/src/lib.rs @@ -131,18 +131,18 @@ pub fn render( rdom.raw_world_mut().add_unique(query_engine); } - { - renderer.update(&rdom); - let mut any_map = SendAnyMap::new(); - any_map.insert(taffy.clone()); - let mut rdom = rdom.write().unwrap(); - let _ = rdom.update_state(any_map); - } - tokio::runtime::Builder::new_current_thread() .enable_all() .build()? .block_on(async { + { + renderer.update(&rdom); + let mut any_map = SendAnyMap::new(); + any_map.insert(taffy.clone()); + let mut rdom = rdom.write().unwrap(); + let _ = rdom.update_state(any_map); + } + let mut terminal = (!cfg.headless).then(|| { enable_raw_mode().unwrap(); let mut stdout = std::io::stdout();