Skip to content

adding useSuspenseQuery enabled option #5789

Answered by TkDodo
WooWan asked this question in General
Discussion options

You must be logged in to vote

we can't expose the enabled option because with enabled:false, we cannot guarantee that data is not undefined, which is one of the reasons you'd want to use useSuspenseQuery in the first place.

suspense works better on the server than it does on the client. if you don't want it on the server, I would probably just useQuery there with suspense:true, which is still supported as of now.

Or, you could just make your QueryFunction throw an error on the server. If that happens, react will render the suspense boundary on the server, and it will then re-fetch on the client. Just make sure to turn off retries :)

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@timsofteng
Comment options

@mironbalcerzak
Comment options

@TkDodo
Comment options

Answer selected by WooWan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants