Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useInfiniteScroll 异步bug #2303

Open
adolfheir opened this issue Aug 26, 2023 · 3 comments
Open

useInfiniteScroll 异步bug #2303

adolfheir opened this issue Aug 26, 2023 · 3 comments

Comments

@adolfheir
Copy link

adolfheir commented Aug 26, 2023

useInfiniteScroll setFinalData 没保证异步竞争
如果上一个service 花 5s
然后这个时候deps 变化 重新run
这个时候第二个service 请求 1s
肯定会导致 setFinalData 出bug

image

https://github.com/alibaba/hooks/blob/master/packages/hooks/src/useInfiniteScroll/index.tsx#L38C4-L38C4

@hchlq
Copy link
Collaborator

hchlq commented Aug 28, 2023

是业务上真实遇到的场景还是看代码发现的 bug 呢

@adolfheir
Copy link
Author

是业务上真实遇到的场景还是看代码发现的 bug 呢

业务上有个接口在不同条件下块慢差异明显 , 然后出现这种case。
然后看了下 这东西内部异步竞争是一点都没做保护呀

@RexingRui
Copy link

@hchlq 这个问题有解么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants