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

Input event handlers report deserialization errors when there is a named input field in the surrounding form #3798

Open
MintSoup opened this issue Feb 25, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@MintSoup
Copy link

MintSoup commented Feb 25, 2025

Problem
Here's a minimal example that reproduces the issue:

use dioxus::prelude::*;
fn main() {
    dioxus::launch(App);
}
#[component]
fn App() -> Element {
    rsx! {
        form {
            input {
                r#type: "file",
                name: "test"
            }

            input {
                oninput: |_| {}
            }
        }
    }
}

Now if I type anything in the second input field, I get the following error on every keystroke:

10:52:03 [linux] ERROR Error parsing user_event: Error("Failed to deserialize event data for event input:  Error(\"invalid type: map, expected a string\", line: 0, column: 0)\n'Object {\n    \"valid\": Bool(true),\n    \"value\": String(\"dsasd\"),\n    \"values\": Object {\n        \"test\": Array [\n            Object {},\n        ],\n    },\n}'", line: 0, column: 0).Contents: Ok(""), raw: Request {
10:52:03 [linux]     method: POST,
10:52:03 [linux]     uri: dioxus://index.html/__events,
10:52:03 [linux]     version: HTTP/1.1,
10:52:03 [linux]     headers: {
10:52:03 [linux]         "content-type": "application/json",
10:52:03 [linux]         "origin": "dioxus://index.html",
10:52:03 [linux]         "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 
(KHTML, like Gecko) Version/18.1 Safari/605.1.15",
10:52:03 [linux]         "dioxus-data": "eyJuYW1lIjoiaW5wdXQiLCJkYXRhIjp7InZhbHVlcyI6eyJ0ZXN0
Ijpbe31dfSwidmFsaWQiOnRydWUsInZhbHVlIjoiZHNhc2QifSwiZWxlbWVudCI6MiwiYnViYmxlcyI6dHJ1ZX0=",
10:52:03 [linux]     },
10:52:03 [linux]     body: [],
10:52:03 [linux] }

I should also mention that a similar error is printed if and when the form's onsubmit handler runs.
Environment:

  • Dioxus version: 0.6.3
  • Rust version: 1.84.0
  • OS info: Arch Linux
  • App platform: Desktop

Questionnaire

I'm interested in fixing this myself but don't know where to start.

@MintSoup MintSoup added the bug Something isn't working label Feb 25, 2025
@mzdk100
Copy link
Contributor

mzdk100 commented Feb 28, 2025

Now I have found that on Windows, the onssubmit event never arrives. I don't know if you have encountered it on your end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants