DioxusLabs / DioxusLabs/dioxus

Using choices.js causes an error in the console

Open
#4,308 0 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**

Found that when using the [choices.js](https://www.jsdelivr.com/package/npm/choices.js) library and clicking on one of the options, the following error pops up in the console:

```
00:26:45 [windows] 2025-06-21T19:26:45.580891Z ERROR ThreadId(01) dioxus_desktop::webview: Error parsing user_event: Error("invalid type: null, expected usize", line: 1, column: 250).Contents: Ok(""), raw: Request {
00:26:45 [windows] method: POST,
00:26:45 [windows] uri: dioxus://index.html/__events,
00:26:45 [windows] version: HTTP/1.1,
00:26:45 [windows] headers: {
00:26:45 [windows] "accept": "*/*",
00:26:45 [windows] "content-type": "application/json",
00:26:45 [windows] "origin": "http://dioxus.index.html",
00:26:45 [windows] "referer": "http://dioxus.index.html/",
00:26:45 [windows] "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0",
00:26:45 [windows] "dioxus-data": "eyJuYW1lIjoibW91c2Vkb3duIiwiZGF0YSI6eyJhbHRfa2V5IjpmYWxzZSwiYnV0dG9uIjowLCJidXR0b25zIjoxLCJjbGllbnRfeCI6NTQ5LCJjbGllbnRfeSI6NDcwLCJjdHJsX2tleSI6ZmFsc2UsIm1ldGFfa2V5IjpmYWxzZSwib2Zmc2V0X3giOjU0OSwib2Zmc2V0X3kiOjQ3MCwicGFnZV94Ijo1NDksInBhZ2VfeSI6NDcwLCJzY3JlZW5feCI6NzY1LCJzY3JlZW5feSI6Njc5LCJzaGlmdF9rZXkiOmZhbHNlfSwiZWxlbWVudCI6bnVsbCwiYnViYmxlcyI6dHJ1ZX0=",
00:26:45 [windows] },
00:26:45 [windows] body: [],
00:26:45 [windows] }
```

**Steps To Reproduce**

Steps to reproduce the behavior:

- Include choices.js on the page and create a to be managed by it.

```rust
use_effect(move || {
eval(r#"
const element = document.getElementById("ic-procedures-select");
const choices = new Choices(element);
"#);
});

rsx! {
select {
id: "ic-procedures-select",
option { value: "extended_session", "Запросить диагностическую сессию" },
option { value: "default_session", "Запросить обычную сессию" },
option { value: "hard_reset", "Перезагрузка блока (hard reset)" },
option { value: "odo", "Чтение пробега" },
}
}
```

- Buld the application and click to any select's option

**Expected behavior**

No messages in console

**Environment:**

- Dioxus version: 0.7.0-alpha.0, 0.7.0-alpha.1, 0.7.0-alpha.2
- Rust version: 1.87.0-stable
- OS info: Windows 11
- App platform: Desktop

**Questionnaire**

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

I don't have time to fix this right now, but maybe later.

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.