DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.35k stars 740 forks source link

"Choose Files" button in `file_upload` example causes app to hang for linux desktop #2149

Closed davidMcneil closed 3 months ago

davidMcneil commented 3 months ago

Problem

Clicking "Choose Files" button in file_upload example causes app to hang on linux desktop ubuntu 22.04.

Steps To Reproduce

Expected behavior

Open file dialog. It hangs as if it is waiting for file selection but the file explorer is never opened. Works great on web so maybe some oddity of my OS.

Screenshots

image

Environment:

Questionnaire

jkelleyrtp commented 3 months ago

We use https://github.com/PolyMeilex/rfd to handle the file popup - can you check to see if these work for you?

davidMcneil commented 3 months ago

Interesting, rfd cargo run --example simple worked fine.

It does not seem to make it to the handler. This does not print anything for file input:

fn app() -> Element {
    rsx! {
        input {
            r#type: "file",
            oninput: move |evt| {
                info!("file input {:?}", evt);
            }
        }
        input {
            r#type: "text",
            oninput: move |evt| {
                info!("text input {:?}", evt);
            }
        }
    }
}
davidMcneil commented 3 months ago

Looks like this line is blocking dialog.pick_file().into_iter().collect(). Replacing it with vec![] at least prevents the app from locking up.

davidMcneil commented 3 months ago

fix https://github.com/DioxusLabs/dioxus/pull/2161