dioxus
dioxus copied to clipboard
Input event handlers report deserialization errors when there is a named input field in the surrounding form
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.
Now I have found that on Windows, the onssubmit event never arrives. I don't know if you have encountered it on your end.
Now I have found that on Windows, the onssubmit event never arrives. I don't know if you have encountered it on your end.
Yes, when using a button element, although an input with type submit works fine.
Now I have found that on Windows, the onssubmit event never arrives. I don't know if you have encountered it on your end.
I think I've tracked down this issue and I've made a new thread for it: https://github.com/DioxusLabs/dioxus/issues/3904
Thank you.