diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 2a1ccce5592..8794ef1bd3c 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -32,6 +32,7 @@ jobs: cargo clippy -- --deny=warnings cargo clippy --features=ssr -- --deny=warnings cargo clippy --features=csr -- --deny=warnings + cargo clippy --features=hydration -- --deny=warnings cargo clippy --all-features --all-targets -- --deny=warnings working-directory: packages/yew @@ -62,6 +63,7 @@ jobs: cargo clippy --release -- --deny=warnings cargo clippy --release --features=ssr -- --deny=warnings cargo clippy --release --features=csr -- --deny=warnings + cargo clippy --release --features=hydration -- --deny=warnings cargo clippy --release --all-features --all-targets -- --deny=warnings working-directory: packages/yew diff --git a/Cargo.toml b/Cargo.toml index 3fc5039774f..527240dd828 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,7 @@ members = [ "examples/two_apps", "examples/webgl", "examples/web_worker_fib", + "examples/ssr_router", "examples/suspense", # Tools diff --git a/examples/function_router/Cargo.toml b/examples/function_router/Cargo.toml index 76258d84570..9bc73d082da 100644 --- a/examples/function_router/Cargo.toml +++ b/examples/function_router/Cargo.toml @@ -13,14 +13,11 @@ yew-router = { path = "../../packages/yew-router" } serde = { version = "1.0", features = ["derive"] } lazy_static = "1.4.0" gloo-timers = "0.2" +wasm-logger = "0.2" +instant = { version = "0.1", features = ["wasm-bindgen"] } [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.2", features = ["js"] } -instant = { version = "0.1", features = ["wasm-bindgen"] } -wasm-logger = "0.2" - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -instant = { version = "0.1" } [features] csr = ["yew/csr"] diff --git a/examples/function_router/index.html b/examples/function_router/index.html index 2c5aee2ff8f..2a75b730809 100644 --- a/examples/function_router/index.html +++ b/examples/function_router/index.html @@ -11,7 +11,7 @@ href="https://cdn.jsdelivr.net/npm/bulma@0.9.0/css/bulma.min.css" /> - + diff --git a/examples/function_router/src/app.rs b/examples/function_router/src/app.rs index ce581a59bf4..4eac347d887 100644 --- a/examples/function_router/src/app.rs +++ b/examples/function_router/src/app.rs @@ -1,4 +1,8 @@ +use std::collections::HashMap; + use yew::prelude::*; +use yew::virtual_dom::AttrValue; +use yew_router::history::{AnyHistory, History, MemoryHistory}; use yew_router::prelude::*; use crate::components::nav::Nav; @@ -47,53 +51,40 @@ pub fn App() -> Html { } } -#[cfg(not(target_arch = "wasm32"))] -mod arch_native { - use super::*; - - use yew::virtual_dom::AttrValue; - use yew_router::history::{AnyHistory, History, MemoryHistory}; - - use std::collections::HashMap; - - #[derive(Properties, PartialEq, Debug)] - pub struct ServerAppProps { - pub url: AttrValue, - pub queries: HashMap, - } +#[derive(Properties, PartialEq, Debug)] +pub struct ServerAppProps { + pub url: AttrValue, + pub queries: HashMap, +} - #[function_component] - pub fn ServerApp(props: &ServerAppProps) -> Html { - let history = AnyHistory::from(MemoryHistory::new()); - history - .push_with_query(&*props.url, &props.queries) - .unwrap(); +#[function_component] +pub fn ServerApp(props: &ServerAppProps) -> Html { + let history = AnyHistory::from(MemoryHistory::new()); + history + .push_with_query(&*props.url, &props.queries) + .unwrap(); - html! { - -