Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

PromptInput: successful async submit clears text typed while the submit was pending

Abierto Apto para principiantes
#518 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@NicolasMilliard ya está trabajando en esto.

Desde el 19/10/2026.

  • #522 de @NicolasMilliard — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
react, typescript
Área
frontend

Línea de trabajo

El error está en la ruta de envío del componente PromptInput y en el estado de PromptInputProvider, donde controller.textInput.clear() se ejecuta después de que se resuelve el onSubmit asíncrono. Empieza leyendo cómo el provider almacena la entrada de texto y cómo PromptInput llama a clear cuando tiene éxito. Está terminado cuando un borrador escrito durante un envío pendiente sobrevive a un envío exitoso, y una prueba cubre un onSubmit retrasado con el texto cambiado a mitad del proceso.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

With PromptInputProvider, an async onSubmit keeps the text until the promise resolves, which is good for retrying a failed send. But after it resolves, PromptInput calls controller.textInput.clear(), which clears the current draft, not the text that was submitted.

The textarea stays editable while the promise is pending. Anything typed during that time is erased when the send succeeds.

Reproduction
  1. Wrap PromptInput in PromptInputProvider.
  2. Use an onSubmit that resolves after a delay, e.g. await new Promise(r => setTimeout(r, 3000)).
  3. Type "first" and press Enter.
  4. While the promise is pending, type " second" (or replace the text).
  5. When the promise resolves, the textarea is emptied and the newer text is lost.
Expected

Only clear the draft if it still equals the submitted text, e.g. a functional update in the provider:

setTextInput((current) => (current === submitted ? "" : current));

(Alternatively, disable the textarea while a submission is pending.)

Environment

prompt-input from the current registry (npx ai-elements@latest add prompt-input), React 19.

Lenguaje dominante
TypeScript
Estrellas
2.5k
Forks
291
Merge medio
20 min
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vercel/ai-elements

Todos los issues de vercel/ai-elements

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.