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

Hot reload not working when Dioxus project is under a Cargo workspace #1990

Closed
ochrons opened this issue Feb 28, 2024 · 3 comments · Fixed by #2096
Closed

Hot reload not working when Dioxus project is under a Cargo workspace #1990

ochrons opened this issue Feb 28, 2024 · 3 comments · Fixed by #2096
Assignees
Labels
bug Something isn't working hot-reload Related to the hot reload crate

Comments

@ochrons
Copy link

ochrons commented Feb 28, 2024

Problem

I have a very simple test fullstack app that works just fine when it's a standalone project. However if I make it a part of a workspace, the hot-reloading functionality no longer works. Basically everything looks to be fine, but the hot_reload websocket gets immediately closed. The other disconnect websocket stays open. When the project is standalone, the hot_reload websocket stays open.

Steps To Reproduce

Reproducible repo at https://github.com/ochrons/dioxus-reload-bug

Steps to reproduce the behavior:

cd web
dx serve --hot-reload

launch browser at 127.0.0.1:8080
make a change in main.rs
see how it changes in the browser

If you check browser web dev tools, you can see that the hot_reload socket is in pending state and messages have been received.

then

cd packages/web
dx serve --hot-reload

launch browser at 127.0.0.1:8080
make a change in main.rs
nothing happens in the browser

If you check browser web dev tools, you can see that the hot_reload socket is not in pending state but has been closed.

Expected behavior

Both cases should work identically

Screenshots

If applicable, add screenshots to help explain your problem.

Environment:

  • Dioxus version: 0.5.0-alpha.0
  • Rust version: 1.76
  • OS info: Windows 11, WSL2
  • App platform: fullstack
@ochrons
Copy link
Author

ochrons commented Feb 28, 2024

Further findings, excluding the packages/web from workspace makes hot-reload work again just fine

[workspace]
resolver = "2"
members = [
    
]
exclude = [
    "web",
    "packages/web"
]

Same thing if the top level Cargo.toml is renamed to something else.

So for some reason if dx finds that the project is indeed a member of a workspace, the hot-reload websocket gets closed early.

@ochrons
Copy link
Author

ochrons commented Feb 28, 2024

This problem also occurs if the packages/web project is excluded from the workspace, but it depends on a crate that is in a workspace e.g.

[dependencies]
data = { path = "../data" }

@ealmloff ealmloff added bug Something isn't working hot-reload Related to the hot reload crate labels Feb 29, 2024
@emk
Copy link

emk commented Mar 6, 2024

I can confirm that hot reloading is failing in a workspace. This is an obstacle to adding a Dioxus UI to a larger, existing project containing multiple crates.

@jkelleyrtp jkelleyrtp self-assigned this Mar 18, 2024
jkelleyrtp added a commit that referenced this issue Mar 18, 2024
- Don't merge dynamic attributes together unnecessarily
- Walk the workspace until we find a target dir with the dioxusin handle
@jkelleyrtp jkelleyrtp mentioned this issue Mar 18, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hot-reload Related to the hot reload crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants