@@ -22,7 +22,6 @@ export const createQueryKeyFunction = ({
22
22
} : {
23
23
plugin : PiniaColadaPlugin [ 'Instance' ] ;
24
24
} ) => {
25
- const coreModule = '../core/queryKeySerializer.gen' ;
26
25
const symbolCreateQueryKey = plugin . registerSymbol ( {
27
26
name : buildName ( {
28
27
config : {
@@ -35,10 +34,6 @@ export const createQueryKeyFunction = ({
35
34
const symbolQueryKeyType = plugin . referenceSymbol (
36
35
plugin . api . getSelector ( 'QueryKey' ) ,
37
36
) ;
38
- const symbolSerializeQueryValue = plugin . registerSymbol ( {
39
- external : coreModule ,
40
- name : 'serializeQueryKeyValue' ,
41
- } ) ;
42
37
43
38
const returnType = tsc . indexedAccessTypeNode ( {
44
39
indexType : tsc . literalTypeNode ( {
@@ -60,6 +55,22 @@ export const createQueryKeyFunction = ({
60
55
client . api . getSelector ( 'client' ) ,
61
56
)
62
57
: undefined ;
58
+ let symbolSerializeQueryValue ;
59
+ if ( client . api && 'getSelector' in client . api ) {
60
+ // @ts -expect-error
61
+ const selector = client . api . getSelector ( 'serializeQueryKeyValue' ) ;
62
+ const existingSymbol = plugin . getSymbol ( selector ) ;
63
+ if ( existingSymbol ) {
64
+ symbolSerializeQueryValue = plugin . referenceSymbol ( selector ) ;
65
+ }
66
+ }
67
+
68
+ if ( ! symbolSerializeQueryValue ) {
69
+ symbolSerializeQueryValue = plugin . registerSymbol ( {
70
+ external : '../core/queryKeySerializer.gen' ,
71
+ name : 'serializeQueryKeyValue' ,
72
+ } ) ;
73
+ }
63
74
64
75
const sdkPlugin = plugin . getPluginOrThrow ( '@hey-api/sdk' ) ;
65
76
const symbolOptions = plugin . referenceSymbol (
0 commit comments