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

Hotreload doesn't pierce through macro contents #2438

Closed
ThomasCartier opened this issue May 22, 2024 · 5 comments
Closed

Hotreload doesn't pierce through macro contents #2438

ThomasCartier opened this issue May 22, 2024 · 5 comments

Comments

@ThomasCartier
Copy link

[Linux, Debian testing]

Hi,
When launching my fullstack app with dx serve --hot-reload --platform fullstack or any variant of this,

I get the console log telling me

Dioxus @ v0.5.0-alpha.2 [17:24:29]

> Hot Reload Mode: RSX
> Watching: [ src, assets, assets ]
> Custom index.html: None
> Serve index.html on 404: True

> Build Features: [ server ]
> Build Profile: Debug
> Build took: 19112 millis

Listening on 127.0.0.1:8080
spinning up hot reloading
hot reloading ready
🔥 Hot Reload WebSocket connected
🔮 Finding updates since last compile...
finished
😳 Hot Reload WebSocket disconnected
And the hot reload doesn't work.

I have to manually relaunch the dx command at each change in the rsx block.

It only occurs when I change the text of a p block for example. As if only changing text from a block was not caught.

A change from

p { "Hello world"}
to
p { "Hello world 2"}

won't trigger anything, but a change from

p { class: "mb-3 text-center",
     {translate!(i18, "messages.hello_world")}
}

to

p { class: "mb-3 text-center",
     {translate!(i18, "messages.hello_world2")}
}

will.

Is it a normal behavior?

Thanks

@luveti
Copy link
Contributor

luveti commented May 23, 2024

Hello, I recommend upgrading to the latest stable version of Dioxus, version 0.5.1. I've personally been using the git version, as fixes are constantly being pushed.

My guess is that the change that triggers the reload is actually a full rebuild, and not an instant template update.

I also recommend keeping dioxus-cli up to date by occasionally running cargo install dioxus-cli.

It may not hurt to try a dx clean as well to see if that fixes things.

@ThomasCartier
Copy link
Author

@luveti thanks, I just uploaded to 0.5.4, but the issue remains: any change that is not textual is taken into account for the recompiling, but textual changes are not caught. :-(

@jkelleyrtp
Copy link
Member

The issue here is you're modifying code in a macro which we can't figure out if should be hotreloaded or not.

This PR #2258 is adding an entirely new, more powerful form of hotreloading, but still wouldn't work with the contents of macros. We do have longer term plans to ship actual, legitimate horeloading of Rust code but that's not available in any form, yet.

With #2258 you could use an I18 { src: "something.2" } component which would receive hotreloading treatment via its props, but nothing yet is plumbed for i18n in the way you're trying to use today.

@jkelleyrtp jkelleyrtp changed the title No hot reload when changing text in rsx block? Hotreload doesn't pierce through macro contents May 24, 2024
@ThomasCartier
Copy link
Author

Nice! I will hold my breath and keep enjoying Dioxus as it is right now

@ThomasCartier
Copy link
Author

Nice! I will hold my breath and keep enjoying Dioxus as it is right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants