We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
竞态取消并不是真的取消发送请求,那么既然请求已经发送,返回值应该可以被缓存
const { data, runAsync, loading, error } = useRequest(getBusinessEntityWalletList, { manual: true, cacheKey: '123', staleTime: 15000, onSuccess(data, params) { console.log('==========success', params) }, }) useEffect(() => { setTimeout(() => { const asyncFn = async () => { console.log('=========run') runAsync({ Page: 1, PageSize: 20 }) runAsync({ ...{ Page: 1, PageSize: 20 }, Page: 2, }) } asyncFn() }, 3000) }, [])
setCache的时机在onSuccess和onMutate时才触发,引用:
hooks/packages/hooks/src/useRequest/src/plugins/useCachePlugin.ts
Line 106 in c7bb04c
但是因为竞态取消机制导致onSuccess只执行一次, 也就是说没办法缓存第一个请求的返回值,这里是否可以改进一下?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
竞态取消并不是真的取消发送请求,那么既然请求已经发送,返回值应该可以被缓存
setCache的时机在onSuccess和onMutate时才触发,引用:
hooks/packages/hooks/src/useRequest/src/plugins/useCachePlugin.ts
Line 106 in c7bb04c
但是因为竞态取消机制导致onSuccess只执行一次, 也就是说没办法缓存第一个请求的返回值,这里是否可以改进一下?
The text was updated successfully, but these errors were encountered: