Not allowing query options with enabled, placeholder data... for useSuspenseQuery #9445
Unanswered
LeonardoTrapani
asked this question in
Ideas
Replies: 1 comment 1 reply
-
the recommendation here would be to use the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, for valid reasons, useSuspenseQuery doesn't allow "enabled" and other properties
A (very common) approach is having queryOptions, and using them in useQuery or useSuspenseQuery:
The issue is those query options can be used without any problem or lint with
useSuspenseQuery
, even though enabled shouldn't be used for a useSuspenseQuery.What do you think about having different types, or figuring out a solution to give a typescript problem (for enabled, and all other properties that shouldn't be used in useSuspenseQuery).
In large codebases, as the one where I am working on currently, it's very easy to use queryOptions that you initiated for another thing, not thinking about if you can use them or not, and the issue can be barely noticeable without any ts error
Would a pr with a solution for this be appreciated?
Beta Was this translation helpful? Give feedback.
All reactions