HuolalaTech / react-query-kit

🕊️ A toolkit for ReactQuery that make ReactQuery hooks reusable and typesafe
MIT License
355 stars 11 forks source link

Variables from useDefaultOptions are not passed to queryFn #18

Closed SpadarShut closed 1 year ago

SpadarShut commented 1 year ago

Variables from useDefaultOptions are actually never passed to queryFn.

const usePost = createQuery<Response, Variables, Error>({
  primaryKey: '/posts',
  queryFn: ({ queryKey: [primaryKey, variables] }) => {
    // variables is actually undefined here
    // ... 
  },
  useDefaultOptions: () => ({ variables: { id: 42 }})
})

Passing variables to hook instance works however.

liaoliao666 commented 1 year ago

Already fixed in v1.4.3

SpadarShut commented 1 year ago

Thanks!