|
The impression I have is that you need to use suspense in order to force solid SSR to wait for all data to be loaded before sending HTML to the client. Assuming this is true, how can I trigger suspense with ApolloClient so all data is loaded on the server before HTML is sent to the client? I think this is equivalent to asking, "how can I trigger suspense without using Looking at the SSR and Suspense docs on the Looking at the source code, it seems possible that this might be a feature request. I have the impression that someone might need to use Ideally, I could import and use a simple function such as |
Replies: 2 comments 2 replies
|
Yeah Suspense especially with concurrent rendering is incredibly complicated. I don't think it is easy to expose. The short answer is if you are using async you should be using resources for loading state. Can you get a promise from ApolloClient? Feed that into a resource and you should be fine. |
|
I found this which I think is promising: https://observable-hooks.js.org/guide/render-as-you-fetch-suspense.html. There is some weird stuff in here but I like their ObservableResource. It basically suggests a model for an observable resource. I think this is much better. We shouldn't be thinking of suspense as something we can control but attack things at a resource level. |
Yeah Suspense especially with concurrent rendering is incredibly complicated. I don't think it is easy to expose. The short answer is if you are using async you should be using resources for loading state.
Can you get a promise from ApolloClient? Feed that into a resource and you should be fine.