V5: Using useSuspenseQueries with enabled = false
I've seen some comments here and there about how
enabled
is not supported by useSuspenseQuery
(though nothing is documented in migration guide). I was wondering how one might migrate from using useQueries
with suspense=true, and some queries being conditional to the new useSuspenseQueries
.
V4
1 Reply
rival-blackOP•2y ago
I Might have actually just answered my own question. I think the most sane option is to split the queries up. Any that CAN be disabled, put into a call to
useQueries
and any that can't, use with useSuspenseQueries
. This however does change the behaviour in that we no longer suspend over that first set at all, which would still be ideal.
I feel like what I really want for useSuspenseQuery
is the ability to define a disableWithPlaceholder
option, which must be the same type as the return value and it concurrently disables the query.