alibaba / alibaba/hooks

useInfiniteScroll 在第一次请求还未返回时,快速切换到其他组件,会造成无限循环的请求

Open
#2,579 6 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
TypeScript
Stars
15k
Forks
2.8k
Avg merge
15h 7m
Merged PRs (30d)
2

Description

![image](https://github.com/alibaba/hooks/assets/34147567/7cece39c-e439-4366-be0f-e41aad77da28)
此处会默认执行一次setTimeout,触发函数scrollMethod,当页面被销毁时,判断条件将永久成立,会一直触发loadMore

Contributor guide

Open the contributing guide

Research direction

Start at the useInfiniteScroll entry point and reproduce a rapid switch or unmount while the first request is still pending. Trace the delayed scrollMethod and loadMore calls, then verify that destroying the page stops further requests and add a regression test for this sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.