File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ Returns
352352您可以使用 ` inferVariables ` 或 ` inferData ` 提取任何自定义 hook 的 TypeScript 类型
353353
354354``` ts
355- import { inferVariables , inferData } from ' react-query-kit'
355+ import { inferVariables , inferData , inferFnData } from ' react-query-kit'
356356
357357type Variables = inferVariables <typeof usePost >
358358type Data = inferData <typeof usePost >
Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ Returns
367367You can extract the TypeScript type of any custom hook with ` inferVariables ` or ` inferData `
368368
369369``` ts
370- import { inferVariables , inferData } from ' react-query-kit'
370+ import { inferVariables , inferData , inferFnData } from ' react-query-kit'
371371
372372type Variables = inferVariables <typeof usePost >
373373type Data = inferData <typeof usePost >
Original file line number Diff line number Diff line change @@ -40,12 +40,16 @@ export function createBaseQuery(
4040 variables,
4141 ...currOptions
4242 } : QueryBaseHookOptions = { } ) => {
43- const { select : _select , ...prevOptions } = {
43+ const {
44+ select : _select ,
45+ variables : prevVariables ,
46+ ...prevOptions
47+ } = {
4448 ...defaultOptions ,
4549 ...useDefaultOptions ?.( ) ,
46- }
50+ } as QueryBaseHookOptions
4751
48- const queryKey = getKey ( variables )
52+ const queryKey = getKey ( variables ?? prevVariables )
4953
5054 const { enabled, ...mergedOptions } = {
5155 ...prevOptions ,
@@ -56,7 +60,6 @@ export function createBaseQuery(
5660 }
5761
5862 const client = useQueryClient (
59- // @ts -ignore
6063 mergedOptions . context ? { context : mergedOptions . context } : queryClient
6164 )
6265
You can’t perform that action at this time.
0 commit comments