reactjs/server-components-demo

What happens to server components if devices goes offline

puchesjr opened this issue · 3 comments

What is the plan/strategy to handle server components in the event device goes offline? Will there be an escape hatch? Will the ui just continue to show the skeleton as example?

I did watch the duration of the talk, my question is not regarding a slow network or a minor delay in the response (e.g., 3 seconds in the talk), but an actual offline scenario. For example, say I am on a train and have connectivity, but as we enter a tunnel network connectivity is lost for a prolonged period of time. On the client-side today, for example, you could fire the fetch call and if no network connectivity show a message (e.g., device off-line). As I understand the video, server components actually need to speak to the server to get the UI streamed down, so the question again is, how do you handle the scenario where I am requesting a server component when the device went offline or goes offline during the streamed response?

Guessing here, but I'm guessing you'd use an ErrorBoundary, much like you would with a failing api call.

Yes, you could have a timeout on your network request, so that it gets rejected after some period and then you use the error boundary to show a message. You could also monitor network state specifically on the client so that you show a message in some part of UI whenever the device goes offline.