File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 11import type { ComputedRef } from "vue" ;
2- import { computed , ref , unref , onUnmounted } from "vue" ;
2+ import { computed , shallowRef , unref , onUnmounted } from "vue" ;
33import type {
44 AxiosError ,
55 AxiosInstance ,
@@ -43,7 +43,7 @@ export function useRequest<T extends Request>(
4343 const requestConfig = getUseRequestConfig ( ) ;
4444 const _axiosIns = options ?. instance || requestConfig . instance ;
4545
46- const sources = ref < CancelTokenSource [ ] > ( [ ] ) ;
46+ const sources = shallowRef < CancelTokenSource [ ] > ( [ ] ) ;
4747 const hasPending = computed ( ( ) => unref ( sources ) . length > 0 ) ;
4848 const { onCompleted, onError } = options || { } ;
4949
@@ -72,7 +72,7 @@ export function useRequest<T extends Request>(
7272 const _source = axios . CancelToken . source ( ) ;
7373
7474 const ready = ( ) => {
75- sources . value = [ ... unref ( sources ) , _source ] ;
75+ sources . value . push ( _source ) ;
7676
7777 return _axiosIns ( { ..._config , cancelToken : _source . token } )
7878 . then ( ( res ) => {
You can’t perform that action at this time.
0 commit comments