Skip to content

Conversation

@ealmloff
Copy link
Member

This PR fixes hydration for static text nodes at the root of templates. Here is a small example that works on this branch, but is broken in the published version of dioxus:

use dioxus::prelude::*;

fn main() {
    launch(app);
}

fn app() -> Element {
    let mut count = use_signal(|| 0);

    rsx! {
        h1 { "High-Five counter: {count}" }
        button { onclick: move |_| count += 1, "Up high!" }
        button { onclick: move |_| count -= 1, "Down low!" }
        if count() > 10 {
            "Big number!"
        }
        else {
            "Small number!"
        }
    }
}

Fixes DioxusLabs/docsite#234

@ealmloff ealmloff added bug Something isn't working fullstack related to the fullstack crate labels Mar 29, 2024
@jkelleyrtp jkelleyrtp merged commit 6a781af into DioxusLabs:main Mar 30, 2024
@ealmloff ealmloff deleted the fix-static-root-text-hydration branch March 30, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fullstack related to the fullstack crate

2 participants