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

多次调用useRequest时,慢返回的请求会覆盖快返回的请求,如何解决? #2624

Open
BoyXuanzai opened this issue Aug 7, 2024 · 3 comments

Comments

@BoyXuanzai
Copy link

使用ahook的useRequest发请求,
比如列表查询 可能后端响应还没返回 用户切换了查询条件这种情况下需要能把之前请求cancel掉,以用户最后点击的查询条件发起的请求返回的结果为最后的结果

@ruixingshi
Copy link
Contributor

是不是可以用 useRequest的取消竞态功能?
image

@whaleluo
Copy link

是不是可以用 useRequest的取消竞态功能? image

不是自动忽略上次请求吗,竞态功能需要单独开启?

@ruixingshi
Copy link
Contributor

是不是可以用 useRequest的取消竞态功能? image

不是自动忽略上次请求吗,竞态功能需要单独开启?

是自动开启的,但是写法上要把接口结果返回后的动作正确的写在 onSuccess里

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