DioxusLabs / DioxusLabs/dioxus

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

Open
#3,798 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**
Here's a minimal example that reproduces the issue:
```rust
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.