File tree 3 files changed +34
-2
lines changed
3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,18 @@ import {
45
45
vueUnRefParams ,
46
46
} from './utils' ;
47
47
48
+ const REACT_DEPENDENCIES : GeneratorDependency [ ] = [
49
+ {
50
+ exports : [
51
+ {
52
+ name : 'useCallback' ,
53
+ values : true ,
54
+ } ,
55
+ ] ,
56
+ dependency : 'react' ,
57
+ } ,
58
+ ] ;
59
+
48
60
const AXIOS_DEPENDENCIES : GeneratorDependency [ ] = [
49
61
{
50
62
exports : [
@@ -208,6 +220,7 @@ export const getReactQueryDependencies: ClientDependenciesBuilder = (
208
220
packageJson ?. devDependencies ?. [ '@tanstack/react-query' ] ;
209
221
210
222
return [
223
+ ...( hasGlobalMutator ? REACT_DEPENDENCIES : [ ] ) ,
211
224
...( ! hasGlobalMutator ? AXIOS_DEPENDENCIES : [ ] ) ,
212
225
...( hasParamsSerializerOptions ? PARAMS_SERIALIZER_DEPENDENCIES : [ ] ) ,
213
226
...( hasReactQuery && ! hasReactQueryV4
@@ -451,7 +464,7 @@ const generateQueryRequestFunction = (
451
464
response . definition . success || 'unknown'
452
465
} >();
453
466
454
- return (\n ${ propsImplementation } \n ${
467
+ return useCallback( (\n ${ propsImplementation } \n ${
455
468
isRequestOptions && mutator . hasSecondArg
456
469
? `options${ context . output . optionsParamRequired ? '' : '?' } : SecondParameter<ReturnType<typeof ${ mutator . name } >>,`
457
470
: ''
@@ -461,7 +474,7 @@ const generateQueryRequestFunction = (
461
474
return ${ operationName } (
462
475
${ mutatorConfig } ,
463
476
${ requestOptions } );
464
- }
477
+ }, [ ${ operationName } ])
465
478
}
466
479
` ;
467
480
}
Original file line number Diff line number Diff line change 33
33
"@tanstack/react-query" : " ^4.22.0" ,
34
34
"@tanstack/svelte-query" : " ^4.24.9" ,
35
35
"@tanstack/vue-query" : " ^4.22.0" ,
36
+ "@types/react" : " 18.3.2" ,
36
37
"axios" : " ^0.26.1" ,
37
38
"msw" : " ^2.0.2" ,
38
39
"swr" : " ^2.2.4" ,
Original file line number Diff line number Diff line change 139
139
resolved "https://registry.yarnpkg.com/@types/js-levenshtein/-/js-levenshtein-1.1.2.tgz#e88f365d6a34beeaff9654706b99a790b5a5aabd"
140
140
integrity sha512-/NCbMABw2uacuyE16Iwka1EzREDD50/W2ggRBad0y1WHBvAkvR9OEINxModVY7D428gXBe0igeVX7bUc9GaslQ==
141
141
142
+ " @types/prop-types@* " :
143
+ version "15.7.12"
144
+ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6"
145
+ integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==
146
+
147
+ " @types/react@18.3.2 " :
148
+ version "18.3.2"
149
+ resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.2.tgz#462ae4904973bc212fa910424d901e3d137dbfcd"
150
+ integrity sha512-Btgg89dAnqD4vV7R3hlwOxgqobUQKgx3MmrQRi0yYbs/P0ym8XozIAlkqVilPqHQwXs4e9Tf63rrCgl58BcO4w==
151
+ dependencies :
152
+ " @types/prop-types" " *"
153
+ csstype "^3.0.2"
154
+
142
155
" @types/statuses@^2.0.1 " :
143
156
version "2.0.3"
144
157
resolved "https://registry.yarnpkg.com/@types/statuses/-/statuses-2.0.3.tgz#9286ef63c99ed9fd739db7f7db5ab9bd6160ab33"
@@ -445,6 +458,11 @@ cross-spawn@^6.0.5:
445
458
shebang-command "^1.2.0"
446
459
which "^1.2.9"
447
460
461
+ csstype@^3.0.2 :
462
+ version "3.1.3"
463
+ resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
464
+ integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
465
+
448
466
csstype@^3.1.1 :
449
467
version "3.1.2"
450
468
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b"
You can’t perform that action at this time.
0 commit comments