dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Interpolation in multiple class tags only works after hotreload

Open oletf opened this issue 7 months ago • 1 comments

Problem

Multiple class tag concatenation doesn't seem to work at load, if one of the class tags contains an interpolated variable.

Steps To Reproduce

The following works as expected

#[component]
fn Thing(more_class: &'static str) -> Element {
   rsx! {
        div { class: "flex {more_class}",
              "text"
        }
    }
}

The following has generated class empty on load after full rebuild or just launching the executable

#[component]
fn Thing(more_class: &'static str) -> Element {
   rsx! {
        div { class: "flex",   // a lot of other classes on the same line
              class: "{more_class}", // hence the multiple class tags which usually get concatenated 
              "text"
         }
    }
}

generates : <div class> until next hotreload, where it properly gets all the concatenated+interpolated class list

Environment:

  • Dioxus version: dioxus 0.6.3
  • Rust version: 1.86.0
  • OS info: Windows10 22H2
  • App platform: desktop

Thanks forward

oletf avatar May 02 '25 11:05 oletf

Also facing this problem on the web platform.

Environment details:

  • dioxus 0.6.3 (fc1f1c2)
  • rustc 1.86.0 (05f9846f8 2025-03-31)
  • OS info: macOS Sonoma 14.5
  • App platform: web

miguelpduarte avatar May 06 '25 15:05 miguelpduarte