-
Reproduce & ReferenceQuestionIs there an elegant way to invoke multiple query parallel when used with the suspense option? BackgroundI didn't want to express the components for the error and loading status as below. - react-query-without-suspense-option - code sandbox I wanted to express the error and loading status more declaratively. Thus, this was achieved through AsyncBoundary, which combines Suspense and ErrorBoundary. - react-query-suspense-sequential Everything seemed to go my way. But there was a price for using the suspense option. Since suspense internally throw promise, it blocks another api call until one api call is completed. So if I look at the network waterfall, I can see that the api is called sequentially as shown below. As a way to solve the above problem, I decided to run the useQuery without the suspense option on the root before the useQuery using the suspense option on the sub-component is executed. Requirements
What I read before ask |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I would like to get support for
I think what should happen then is that react suspends until all suspense queries have finished, while the non-suspense queries just run normally next to it. If you want to contribute, please give this a try :) |
Beta Was this translation helpful? Give feedback.
I would like to get support for
suspense
onuseQueries
, but it's a long standing, open issue. What I think would need to happen is:observer.fetchOptimistic
I think what should happen then is that react suspends until all suspense queries have finished, while th…