Controlled input keeps text that onChange rejected (no setState)
Maintainer thường phản hồi trong vòng 1 ngày
@bilalvur đang làm issue này rồi.
Từ ngày 30/10/2026.
Đá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
- 55/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ệ
- playwright, react, typescript, vite
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start by tracing how Redact handles controlled input values and change events; compare that path with React using the supplied main.js reproduction. Build and preview with Vite, then type 1a2 and confirm the input displays 12 when onChange rejects the change. The issue names no repository source files or tests, so locate the relevant implementation and regression test first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
A controlled input whose onChange rejects a change by not calling setState keeps the typed text. React writes the controlled value back after the event, so the input never shows rejected text. Redact leaves it in the DOM, out of sync with state.
Typing 1a2 into the input below:
- React 19.3.1:
12 - Redact 0.2.3:
1a2
Same result in Chromium 156, Firefox 157 and WebKit 27.2 (Playwright 1.64.1, production build). Redact 0.1.4, 0.1.5, 0.2.0 and 0.2.1 behave the same, so it is not a 0.2 regression. #64 is also about controlled text inputs, but a different symptom.
We hit it in a form field that ignores input not starting with a number.
Reproduction
package.json
{
"name": "redact-controlled-input-repro",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"preview": "vite preview --host 127.0.0.1"
},
"dependencies": {
"@tanstack/redact": "0.2.3",
"react": "19.3.1",
"react-dom": "19.3.1"
},
"devDependencies": {
"vite": "8.3.4"
}
}
index.html
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Controlled input reproduction</title></head>
<body><div id="root"></div><script type="module" src="/main.js"></script></body>
</html>
vite.config.js
import { redact } from '@tanstack/redact/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: process.env.NO_REDACT ? [] : [redact()],
})
main.js
import { createElement, useState } from 'react'
import { createRoot } from 'react-dom/client'
function Digits() {
const [value, setValue] = useState('')
return createElement('input', {
value,
onChange: (event) => {
if (/^\d*$/.test(event.target.value)) setValue(event.target.value)
},
})
}
createRoot(document.getElementById('root')).render(createElement(Digits))
Run npm install && npm run build && npm run preview, then type 1a2. With NO_REDACT=1 npm run build it shows 12.
I used Claude Code to narrow this down from our app and to run the repro across browsers and versions.
- Ngôn ngữ chính
- TypeScript
- Star
- 581
- Fork
- 28
- Merge trung bình
- 13 giờ 48 phút
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 TanStack/redact
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
TanStack/redact#142 · 4 bình luận ·
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
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 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 1-2 ngày 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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TanStack/redact
Issue tương tự
-
inference/go type/feature
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/opencode#65148 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
truapi-release
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
paritytech/product-sdk#529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Mansudae TVĐang mởapproved check:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/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 77/100
devlikeapro/waha#2369 ·
Maintainer thường phản hồi trong vòng 5 ngày