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

fix the downcast for formdata try_as_web_event #3227

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

rogusdev
Copy link
Contributor

Demo app to prove this change:

use dioxus::prelude::*;
use dioxus_logger::tracing::{info, Level};
use dioxus::web::WebEventExt;

fn main() {
    dioxus_logger::init(Level::INFO).expect("failed to init logger");
    info!("starting app");
    launch(App);
}

#[component]
fn App() -> Element {
    rsx! {
        input {
            type: "file",
            onchange: move |evt| {
                info!("onchange");
                if let Some(evt) = evt.try_as_web_event() {
                    info!("web event");
                }
            },
        }
    }
}

Before my change, selecting a file would only log "onchange". After my change you get both "onchange" and "web event" as you would expect.

I suspect this is a parallel problem to #3137 and possibly needs to be updated in more places as well.

@rogusdev
Copy link
Contributor Author

I am suspicious that WebImageEvent needs to be updated in the same way (I am not qualified to test making such a change tho), however all the other impls seem to be returning the web_sys event type correctly, to my eyes.

@ealmloff
Copy link
Member

Thanks!

@ealmloff ealmloff enabled auto-merge (squash) November 16, 2024 23:28
@ealmloff ealmloff merged commit 1b54cb9 into DioxusLabs:main Nov 17, 2024
17 checks passed
@rogusdev rogusdev deleted the formdata-downcast branch November 17, 2024 00:21
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

Successfully merging this pull request may close these issues.

3 participants