dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Dioxus beginner: Hot reloading is not working properly when editing rsx!

Open luis-prates opened this issue 1 year ago • 1 comments

Problem

When I edit the contents of a string inside an element in my rsx! macro, the hot reload feature doesn't trigger, but if I make changes to something outside the string, such as adding a new element to the macro, it does.

Steps To Reproduce

Steps to reproduce the behavior:

  • create simple Element with rsx! macro and, for example, a div { "style": "width: 200px; height: 200px; background-color: yellow;" }
  • change the background-color setting from yellow to red
  • hot reload not triggered

Expected behavior

I expect the hot reload to trigger and show the changes performed on the browser

Environment:

  • Dioxus version: 0.5.7
  • Rust version: 1.84.0, nightly
  • OS info: Windows 11
  • App platform: web

Questionnaire

I'm interested in fixing this myself but don't know where to start

luis-prates avatar Oct 23 '24 23:10 luis-prates

Hot reloading in 0.5 is limited to rsx that is not nested within other rust expressions like loops, if statements, components, and raw expressions. For example, this cannot be hot reloaded in 0.5:

rsx! { Comp { div { "style": "width: 200px; height: 200px; background-color: yellow;" } } }

0.6 removes those limitations

The version of dioxus you are using and the version of the CLI you are using also need to match. For example, you can't use the 0.5 version of dioxus with the 0.6 CLI

ealmloff avatar Oct 25 '24 15:10 ealmloff