Skip to content

Commit b9b92d4

Browse files
committed
perf: setup run request replace mount
1 parent 24dd4c2 commit b9b92d4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

packages/hooks/src/useRequest/useRequestImplement.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ref, reactive, toRefs, onUnmounted, inject, UnwrapRef, watchEffect, computed, isRef, onMounted, unref } from 'vue'
1+
import { ref, reactive, toRefs, onUnmounted, inject, UnwrapRef, watchEffect, computed, isRef, unref } from 'vue'
22

33
import Fetch from './Fetch'
44
import { USEREQUEST_GLOBAL_OPTIONS_PROVIDE_KEY } from './config'
@@ -93,12 +93,10 @@ function useRequestImplement<TData, TParams extends any[]>(
9393
})
9494

9595
// manual
96-
onMounted(() => {
97-
if (!manual && fetchInstance.options.refreshDeps !== true) {
98-
const params = fetchInstance.state.params || options.defaultParams || []
99-
if (unref(ready)) fetchInstance.run(...(params as TParams))
100-
}
101-
})
96+
if (!manual && fetchInstance.options.refreshDeps !== true) {
97+
const params = fetchInstance.state.params || options.defaultParams || []
98+
if (unref(ready)) fetchInstance.run(...(params as TParams))
99+
}
102100

103101
// onUnmounted cancel request
104102
onUnmounted(() => {

0 commit comments

Comments
 (0)