Controlled input keeps text that onChange rejected (no setState)
Los mantenedores suelen responder en 1 día
@bilalvur ya está trabajando en esto.
Desde el 30/10/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- playwright, react, typescript, vite
- Área
- frontend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 581
- Forks
- 28
- Merge medio
- 13 h 48 min
- PR fusionados (30 d)
- 45
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/redact
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
TanStack/redact#142 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 20/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/redact
Issues similares
-
inference/go type/feature
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
anomalyco/opencode#65148 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
truapi-release
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
paritytech/product-sdk#529 ·
Los mantenedores suelen responder en 1 día
-
Add: Mansudae TVAbiertoapproved check:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
devlikeapro/waha#2369 ·
Los mantenedores suelen responder en 5 días