4 comments (4 comments)0 reactions (0 reactions)0 assignees (0 assignees)TypeScript12,849 stars (12,849 stars)2,471 forks (2,471 forks)batch import
help wanted
Description
此处会默认执行一次setTimeout,触发函数scrollMethod,当页面被销毁时,判断条件将永久成立,会一直触发loadMore
Contributor guide
- Tech stack
- typescriptreact
- Domain
- frontend
- Issue type
- bug
- DifficultyEstimated implementation difficulty for a new contributor, from 1 for very small changes to 5 for expert-level work.
- 3
- Estimated timeA rough time range for an experienced contributor to investigate, implement, test, and prepare a pull request.
- 1-3 hours
- Activity statusHow available the issue appears right now: fresh, active, stale, blocked, or waiting on maintainer input.
- fresh
- ClarityHow clearly the issue explains the expected change, acceptance criteria, and next step.
- mostly clear
- Prerequisites
- understanding of React hooks lifecyclebasic knowledge of useEffect cleanup
- Newbie friendlinessA 1-100 score estimating how approachable this issue is for first-time contributors.
- 50
- Research direction
- 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.