Skip to content

Empty spread attributes sometimes breaks hydration #4646

@ealmloff

Description

@ealmloff

Problem

The following example breaks hydration in the 0.6 and git version of dioxus

use dioxus::prelude::*;

fn main() {
    dioxus::launch(|| {
        rsx! {
            Comp {}
            Comp {}
            Button {}
        }
    });
}

#[component]
fn Button() -> Element {
    let mut count = use_signal(|| 0);

    rsx! {
        button {
            onclick: move |_| {
                count += 1;
            },
            "Count: {count}"
        }
    }
}

#[component]
fn Comp(#[props(extends = GlobalAttributes)] attributes: Vec<Attribute>) -> Element {
    rsx! {
        div {
            width: 100,
            div {
                ..attributes,
            }
        }
    }
}

Expected behavior

The example should run correctly

Environment:

  • Dioxus version: main
  • Rust version: nightly
  • OS info: MacOS
  • App platform: Web

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfullstackrelated to the fullstack crate

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions