Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hydration for static text nodes at the root of the template #2184

Merged
merged 2 commits into from
Mar 30, 2024

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
9 checks passed
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use_resource is breaking if you access the page directly
2 participants