Open
Description
openapi-react-query version
0.5.0
Description
Hi !
I'd like to override the queryKey
parameter of tanstack query, so I tried to follow the doc of useQuery :
const { data, error, isLoading } = $api.useQuery(
"post",
"/api/my_endpoint",
{
body: {
some_params: "some_value"
},
},
{
queryKey: ["api/my_endpoint", someOther, variables],
},
);
But I am getting this error :
TypeError: fn is not a function
queryFn index.ts:197
fetchFn query.ts:457
run retryer.ts:153
run retryer.ts:199
promise callback*createRetryer/run/< retryer.ts:195
promise callback*run retryer.ts:160
run retryer.ts:199
At this line.
If I add a breakpoint, I see that
[ method, path, init ] = ["api/my_endpoint", someOther, variables]
Reproduction
Cf above.
Expected result
I would have expected the request to succeed, and to pass the queryKey
param to react-query.
Reading the source code for openapi-react-query, I understand that there might be a conflict between the queryKey
variable used internally by openapi-react-query
, and the queryKey
parameter that I am trying to pass to react-query, via the options
?
(Unless I misunderstood something from the docs, in which case I apologize !)
Thanks
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)