-
Notifications
You must be signed in to change notification settings - Fork 0
优化 useAsyncPool 心智负担过重的情况 #9
Copy link
Copy link
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Activity
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
说明
现有的 useAsyncPool 在面对有依赖的并发请求场景,需要开发者写很多的条件判断代码,心智负担过重
场景
假设:初始化发起并发请求A,请求A获取的结果去请求B
伪代码:
上述场景有两个不足:
useAsyncPool 没有提供自动加载的能力,需要useEffect在初始化进行手动请求(runTaskA)
useAsyncPool 没有处理请求依赖的问题,需要判断前置请求是否加载完成,再手动加载下一个任务