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

Dioxus Playground Hot Reload Support #3098

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DogeDark
Copy link
Member

This adds hot reload support to the web renderer through the window.postMessage system for dioxus-playground. The devtools-playground feature enables this system.

Required by DioxusLabs/playground#13

@DogeDark DogeDark added enhancement New feature or request web relating to the web renderer for dioxus labels Oct 25, 2024
@jkelleyrtp
Copy link
Member

I think dioxus-devtools should simply expose the hotreload message pipe by default without the additional feature. I do not want to add any more features or [cfg(feature = "xyz")]. Switching over to devtools from hotreload should open the "semantic door" to more changes that turn on bells and whistles that get disabled in release.

#[cfg(feature = "devtools-playground")]
fn playground(tx: UnboundedSender<HotReloadMsg>) {
let window = web_sys::window().unwrap();
window.set_onmessage(Some(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also call the original onmessage if there was one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to check if there is already a onmessage callback registered and to call it from inside our callback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web relating to the web renderer for dioxus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants