Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#518 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@NicolasMilliard ci sta già lavorando.

Dal 19/10/2026.

  • #522 di @NicolasMilliard — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Il bug si trova nel percorso di invio del componente PromptInput e nello stato di PromptInputProvider, dove controller.textInput.clear() viene eseguito dopo che onSubmit asincrono si è risolto. Inizia leggendo come il provider memorizza l'input di testo e come PromptInput chiama clear in caso di successo. È completato quando una bozza digitata durante un invio in sospeso sopravvive a un invio riuscito, e un test copre un onSubmit ritardato con il testo modificato a metà.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
2.5k
Fork
291
Merge medio
20m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/ai-elements

Tutte le issue di vercel/ai-elements

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.