[2.0] An input bound with `value={signal()}` keeps text the handler rejected
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start by locating the value binding implementation and its tests in Solid's web package; the issue provides a jsdom reproduction using @solidjs/web. Check how the binding updates the DOM when an input handler leaves the signal unchanged, and compare that behavior with the reported unrelated-update case. Done means the rejected or truncated text reconciles with the bound state without reintroducing the unrelated-update behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
With <input value={v()} onInput={…}>, if the handler filters or truncates the input and the state ends up unchanged, the DOM keeps the text the user typed. The value binding only rewrites the input when its effect re-runs, so a rejected keystroke never reverts. React's controlled inputs revert to the state value.
Your Example Website or App
Minimal repro inline below (@solidjs/web, jsdom).
Steps to Reproduce the Bug or Issue
const [d, setD] = createSignal("");
const [s, setS] = createSignal("");
render(() => (
<>
<input id="a" value={d()} onInput={e => setD(e.currentTarget.value.replace(/[^0-9]/g, ""))} />
<input id="b" value={s()} onInput={e => setS(e.currentTarget.value.slice(0, 3))} />
</>
), container);
// simulate typing: input.value = text; input.dispatchEvent(new Event("input", { bubbles: true })); flush();
| Typed | State | DOM |
|---|---|---|
1 |
1 |
1 |
1a |
1 |
1a |
1a2 |
12 |
12 (state changed, so it's rewritten) |
abc (max 3) |
abc |
abc |
abcd (max 3) |
abc |
abcd |
Expected behavior
Either:
- after the handler runs, the DOM value is reconciled with the bound value even if the signal didn't change; or
- there's a documented pattern or primitive for controlled inputs.
Today's workaround is writing e.currentTarget.value = d() back by hand in the handler.
Screenshots or Videos
No response
Platform
- OS: macOS (Darwin 25.5)
- Browser: n/a (reproduced in Node v24.18.0 with vitest, importing source)
- Version: solid
next@ b0ad1df50 (2026-10-20, after 2.0.0-rc.16)
Additional context
- A common React pattern: number-only fields, max length and input masks.
- The converse problem also happens: OpenClaw found that a
valuebinding rewrites the input whenever its compiled effect re-runs, even with an equal value. For example, when it's grouped with other reactive attributes or read through a spread props object, unrelated updates wiped uncommitted text (https://github.com/openclaw/openclaw/blob/1989e3dc436/.agents/skills/solid/references/lessons.md#L9). Both point to the same root cause: thevaluebinding syncs the DOM when its effect runs, rather than by comparing the DOM against the bound value. - Not yet checked in a real browser: jsdom simulates typing by setting
valueand dispatchinginput, which mirrors what the browser does, but I haven't confirmed it in a real browser.
- Ngôn ngữ chính
- TypeScript
- Star
- 36.2k
- Fork
- 1.1k
- Merge trung bình
- 11 giờ
- Pull request đã merge (30 ngày)
- 343
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của solidjs/solid
-
`lazy()`: remounting an already-loaded component renders empty (or the Suspense fallback) since 1.9.14Có thể đã có người làm @itisrmk đã nhận 7 ngày trước. Đang mở1.x
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`createRoot`'s dispose function keeps `fn` alive, so `<For>`/`<Index>` rows retain removed list itemsCó thể đã có người làm @boombang đã nhận 9 ngày trước. Đang mở1.x
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/solid
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
farion1231/cc-switch#8829 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverĐang mởdoc-audit enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100