4 commenti (4 commenti)0 reazioni (0 reazioni)0 assegnatari (0 assegnatari)TypeScript12.849 star (12.849 star)2471 fork (2471 fork)batch import
help wanted
Descrizione
此处会默认执行一次setTimeout,触发函数scrollMethod,当页面被销毁时,判断条件将永久成立,会一直触发loadMore
Guida contributor
- Tech stack
- typescriptreact
- Dominio
- frontend
- Tipo issue
- bug
- DifficoltàQuanto dovrebbe essere impegnativa per un nuovo contributor.
- 3
- Tempo stimatoTempo stimato per completare e verificare uno scope piccolo.
- 1-3 hours
- Stato attivitàQuanto è probabile che la issue sia ancora attiva e reviewable.
- fresh
- ChiarezzaQuanto chiaramente la issue descrive problema, scope e risultato atteso.
- mostly clear
- Prerequisiti
- understanding of React hooks lifecyclebasic knowledge of useEffect cleanup
- Adatta ai principiantiQuanto la issue è adatta a contributor alla prima esperienza.
- 50
- Direzione di ricerca
- Investigate the useInfiniteScroll hook implementation, specifically the setTimeout call that triggers scrollMethod. The issue suggests that when the component unmounts before the timeout fires, the condition becomes permanently true causing infinite loadMore calls. Check the cleanup logic in the useEffect and ensure that the timeout is cleared on unmount. Look at the return statement of the effect to see if clearTimeout is called. The relevant file is likely `src/useInfiniteScroll/index.ts` or similar. Also review any existing comments or related PRs for proposed fixes.