dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

UI no longer renders even after reverting recently added code

Open J2ane opened this issue 1 month ago • 7 comments

Environment:

  • OS: Linux (kernel 6.16.8, x86_64)

  • Dioxus version: [0.7.0]

  • Rust version: [rustc 1.91.0 (f8297e351 2025-10-28)]

  • Originally, I was able to use this code to disable Dioxus's built-in menu bar and display content.:

[package]
name = "test1"
version = "0.1.0"
edition = "2024"

[dependencies]
dioxus = { version = "0.7.0", features = ["desktop"]}
dioxus-desktop = { version = "0.7.0-rc.3" }
dioxus-primitives = { git = "https://github.com/DioxusLabs/components", version = "0.0.1", default-features = false }

[profile]

[profile.wasm-dev]
inherits = "dev"
opt-level = 1

[profile.server-dev]
inherits = "dev"

[profile.android-dev]
inherits = "dev"
use dioxus::prelude::*;
use dioxus_desktop::{window, Config, WindowBuilder};

fn main() {
    dioxus::LaunchBuilder::desktop()
        .with_cfg(
            Config::new().with_window(
                WindowBuilder::new()
                    .with_title("Hello Dioxus")
                    .with_decorations(false)
                    .with_always_on_top(true)
    
            )
        )
        .launch(App);
}

#[component]
fn App() -> Element {
    use_effect(|| {
        window().set_decorations(true);
    });

    rsx!{
        "Hello Dioxus"
    }
}
  • After I added the Components Menubar, the app stopped behaving correctly: the Dioxus built-in menu bar and title bar no longer appear, and no content is displayed.:
Image
use dioxus::prelude::*;
use dioxus_desktop::{window, Config, WindowBuilder};
use dioxus_primitives::menubar::*;


fn main() {
    dioxus::LaunchBuilder::desktop()
        .with_cfg(
            Config::new().with_window(
                WindowBuilder::new()
                    .with_title("Hello Dioxus")
                    .with_decorations(false)
                    .with_always_on_top(true)

            )
        )
        .launch(App);

}

#[component]
fn App() -> Element {
    use_effect(|| {
        window().set_decorations(true);
    });

    rsx!{
        div { 
            Menubar {
                MenubarMenu {
                    index: 0usize,
                    MenubarTrigger {
                        "File"
                    }
                    MenubarContent {
                        MenubarItem {
                            index: 0usize,
                            value: "new".to_string(),
                            on_select: move |v| {
                                println!("点击了:{}", v)
                            },
                            "New"
                        }
                        MenubarItem {
                            index: 1usize,
                            value: "open".to_string(),
                            on_select: move |v| {
                                println!("点击了:{}", v)
                            },
                            "Open"
                        }
                    }
                }
            }
        }

        "Hello Dioxus"
    }
}
  • Finally, even after reverting to the most basic setup, the content still does not display. Running cargo clean and recompiling did not resolve the issue.
Image
use dioxus::prelude::*;
// use dioxus_desktop::{window, Config, WindowBuilder};
// use dioxus_primitives::menubar::*;


fn main() {
    // dioxus::LaunchBuilder::desktop()
    //     .with_cfg(
    //         Config::new().with_window(
    //             WindowBuilder::new()
    //                 .with_title("Hello Dioxus")
    //                 .with_decorations(false)
    //                 .with_always_on_top(true)
    //
    //         )
    //     )
    //     .launch(App);

    // dioxus::launch(App);
    dioxus::LaunchBuilder::desktop().launch(App);


}

#[component]
fn App() -> Element {
    // use_effect(|| {
    //     window().set_decorations(true);
    // });

    rsx!{
        // div { 
        //     Menubar {
        //         MenubarMenu {
        //             index: 0usize,
        //             MenubarTrigger {
        //                 "File"
        //             }
        //             MenubarContent {
        //                 MenubarItem {
        //                     index: 0usize,
        //                     value: "new".to_string(),
        //                     on_select: move |v| {
        //                         println!("点击了:{}", v)
        //                     },
        //                     "New"
        //                 }
        //                 MenubarItem {
        //                     index: 1usize,
        //                     value: "open".to_string(),
        //                     on_select: move |v| {
        //                         println!("点击了:{}", v)
        //                     },
        //                     "Open"
        //                 }
        //             }
        //         }
        //     }
        // }
        //
        "Hello Dioxus"
    }
}

J2ane avatar Nov 01 '25 04:11 J2ane

  • I created a new project: the web version displays content correctly, but the desktop version still does not render any content. It's really strange—could this be caused by a mistake on my side?
[dependencies]
dioxus = { version = "0.7.0" }
use dioxus::prelude::*;

fn main() {
    dioxus::launch(App);
}

// The #[component] attribute streamlines component creation.
// It's not required, but highly recommended. It will lint incorrect component definitions and help you create props structs.
#[component]
fn App() -> Element {
    rsx! { "hello world!" }
}
dx serve --web

  • desktop,
[dependencies]
dioxus = { version = "0.7.0", features = ["desktop"] }
# dioxus = { version = "0.7.0" }
use dioxus::prelude::*;

fn main() {
    // dioxus::launch(App);
    dioxus::LaunchBuilder::desktop().launch(App);
}

// The #[component] attribute streamlines component creation.
// It's not required, but highly recommended. It will lint incorrect component definitions and help you create props structs.
#[component]
fn App() -> Element {
    rsx! { "hello world!" }
}
dx serve --desktop

J2ane avatar Nov 01 '25 07:11 J2ane

I put my computer into hibernation before taking a break. When I resumed and ran the same code today without any modifications, it started working normally again. I'm not sure whether this should be considered a Dioxus bug or an issue related to my system.

Image

J2ane avatar Nov 02 '25 02:11 J2ane

If you run into this issue again, it would be helpful to see what the network state and console looks like from inside the webview. Dioxus 0.7 switched to a websocket to send edits into the webview. There is a chance something in your system or webview is interfering with that websocket connection causing the UI not to render

ealmloff avatar Nov 03 '25 14:11 ealmloff

I’m experiencing the same issue on Android. After upgrading from Dioxus 0.6.3 to 0.7.1 (and discovering that I now need to explicitly pass --target aarch64-linux-android to dx bundle --release --platform android), the screen stays completely white—no components render at all. The same project renders fine when targeting the web in Firefox.

Based on @ealmloff’s comment, I tried granting the app internet access, and with that permission enabled the UI renders correctly. Without it, the screen remains blank.

Is the new websocket-based update mechanism expected to require network permissions on Android? And if so, does that imply that fully offline apps are no longer supported, or is this an unintended side-effect?

I’d be happy to help test or provide more information if needed.

erzoe avatar Nov 30 '25 15:11 erzoe

Is the new websocket-based update mechanism expected to require network permissions on Android? And if so, does that imply that fully offline apps are no longer supported, or is this an unintended side-effect?

Dioxus desktop only uses websockets on the local network to communicate with the webview. It should still work offline

ealmloff avatar Dec 02 '25 17:12 ealmloff

@ealmloff Thank you for your answer. I am very happy that it should still work offline, too. Just to be clear that there is no misunderstanding: In my case this was happening on Android. (I have not tried Desktop.) And I was talking about the Network permission, not about connectivity. The app works if I grant the Network permission, even if the phone is in airplane mode. But without the Network permission I am getting just a white screen.

erzoe avatar Dec 02 '25 20:12 erzoe

@ealmloff Thank you for your answer. I am very happy that it should still work offline, too. Just to be clear that there is no misunderstanding: In my case this was happening on Android. (I have not tried Desktop.) And I was talking about the Network permission, not about connectivity. The app works if I grant the Network permission, even if the phone is in airplane mode. But without the Network permission I am getting just a white screen.

Yes, the mobile target uses dioxus_desktop (the webview renderer) under the hood. Network permission is could be required for now even though we are only using the local network

ealmloff avatar Dec 02 '25 22:12 ealmloff