isValidating state updates to false before debounced async validation completes

Aberta
#2,045 2 comentários 1 reação 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

  • #2047 de @AdrianLea — fechado sem integrar

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
react, typescript
Domínio
frontend

Direção de pesquisa

Comece com a reprodução mínima em src/index.tsx do exemplo vinculado do StackBlitz e acompanhe o fluxo de validação assíncrona para entradas consecutivas de firstname. Reproduza o problema digitando “erro”, aguardando e depois adicionando “r”; considera-se concluído quando isValidating permanece true até que todas as validações em andamento sejam concluídas e o erro apareça.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

v1 v2: needs investigation
Describe the bug

isValidating form state updates to false before debounced async validation completes. For example when the first async validation is resolving and a second async validation is triggered, once the first async validation resolves, isValidating is set to false even though the second async validation is still in flight.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-s6svm3er?file=src%2Findex.tsx

Steps to reproduce
  1. Type in "erro" in firstname
  2. Wait roughly half a second then add an "r" to make "error"
  3. isValidating disappears -> false
  4. After about half a second later the error appears
Expected behavior

As a user I expect, isValidating to be true whenever there is an async validation in flight. So the isValidating... text should not disappear before all async validations have completed. My specific use-case is showing a loading state while async validation is ongoing, however since the isValidating
state becomes false early this can be misleading to users.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Google Chrome

TanStack Form adapter

react-form

TanStack Form version

1.28.3

TypeScript version

v5.8.3

Additional context

No response

Linguagem predominante
TypeScript
Estrelas
6.8k
Forks
717
Merge médio
5d 22h
PRs com merge (30d)
14

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TanStack/form

Todas as issues de TanStack/form

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.