HuolalaTech / react-query-kit

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

Variables Optional #60

Closed m4ttheweric closed 4 months ago

m4ttheweric commented 4 months ago

Hi, this is somewhat of a question on the design.

When a query requires variables, the variables property on the resulting QueryHook is optional no matter what.

This seems less-than ideal as it allows developers to implement the hook incorrectly and only discover the issue when the query fails due to missing arguments.

I'm curious what the thought process was behind this design choice and if it's something that can be controlled.

Thanks!

Matt

liaoliao666 commented 4 months ago

Because the variables option may comes from the other way. Like

createQuery({ variables: {...} })

or

createQuery({ use: [useNext => (options) => useNext({...options, variables: {...} })]})