alibaba/hooks

useRequest的debounceLeading和ready结合使用时不生效

Open

#2.581 aberto em 26 de jun. de 2024

Ver no GitHub
 (5 comments) (0 reactions) (0 assignees)TypeScript (2.471 forks)batch import
help wanted

Métricas do repositório

Stars
 (12.849 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

  const [ready, setReady] = useState(false);
  const { data, loading, run } = useRequest(getEmail, {
    debounceWait: 3000,
    debounceLeading: true,
    ready: ready
  });

上述代码在sandbox时调试时,发现debounceLeading偶现不生效,即有时候当ready切换到true时,getEmail不立即执行 20240626145126_rec_

偶现是当manual明确设置为false的时候,leading有时候能起作用😂

版本:3.8.0

Guia do colaborador