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

[Feature Request] ready 选项的表现行为与 refreshDeps 存在冲突 #243

Open
s3xysteak opened this issue Jul 11, 2024 · 0 comments
Open

Comments

@s3xysteak
Copy link

需求描述 Feature Description

由于ready在 false → true 时会自动发出请求,
如果和refreshDeps共同使用,这将会同时发出两次请求
例如

const val = ref()
setTimeout(() => val.value = 'hello', 1000)
setTimeout(() => val.value = 'world', 2000)

useRequest(foo, {
  ready: () => !!val.value,
  refreshDeps: val
})

这看起来是违背直觉的

建议的解决方案 Proposed Solution

建议 ready 只用于判断是否允许发出请求,而不应该有自动发出请求的功能
当ready为false时,请求将会被阻止
当ready为true时,不进行任何行为

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

1 participant