Skip to content

Commit be54f23

Browse files
committed
refactor: replace throttleWait with computed value
1 parent 5beafa0 commit be54f23

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: packages/hooks/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-hooks-plus",
3-
"version": "2.3.0-beta.7",
3+
"version": "2.3.0-beta.8",
44
"description": "Vue hooks library",
55
"files": [
66
"dist",

Diff for: packages/hooks/src/useRequest/plugins/useThrottlePlugin.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ const useThrottlePlugin: UseRequestPlugin<unknown, unknown[]> = (
2424
const _originRunAsync = fetchInstance.runAsync.bind(fetchInstance)
2525
const throttled = ref<DebouncedFunc<any>>()
2626

27-
watch([throttleWait, options], (cur) => {
27+
const throttleWaitComputed = computed(() => {
28+
return unref(throttleWait)
29+
})
30+
31+
watch([throttleWaitComputed, options], (cur) => {
2832
if (originThrottled) {
2933
originThrottled.cancel()
3034
fetchInstance.runAsync = _originRunAsync

0 commit comments

Comments
 (0)