Skip to content

Commit

Permalink
chore: make DialogContent happy by ensuring there's always a reactnod…
Browse files Browse the repository at this point in the history
…e child
  • Loading branch information
Tethik committed Nov 14, 2023
1 parent a552c8e commit ff8a832
Showing 1 changed file with 38 additions and 36 deletions.
74 changes: 38 additions & 36 deletions app/src/components/model/connectivity/ConnectivityCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,52 +36,54 @@ function ConnectivityCheck() {
  Who broke the internet?
</DialogTitle>
<DialogContent>
{isEstablishing ||
(timeout && (
<Typography>
<b>*modem noises*</b> connecting...
</Typography>
))}
{!isEstablishing && !isConnected && !timeout && (
<>
<Typography>
Your websocket connection to the server has timed out or been
closed remotely. This could be due to bad connectivity, or the
Gram server having a bad time.
</Typography>
<>
{isEstablishing ||
(timeout && (
<Typography>
<b>*modem noises*</b> connecting...
</Typography>
))}
{!isEstablishing && !isConnected && !timeout && (
<>
<Typography>
Your websocket connection to the server has timed out or been
closed remotely. This could be due to bad connectivity, or the
Gram server having a bad time.
</Typography>

{fails > 0 && (
<>
<br />
<Typography>Reconnection failed, try again?</Typography>
</>
)}
{fails > 0 && (
<>
<br />
<Typography>Reconnection failed, try again?</Typography>
</>
)}

{/* Unfortunately the error given is not very descriptive.
{/* Unfortunately the error given is not very descriptive.
https://stackoverflow.com/questions/18803971/websocket-onerror-how-to-read-error-description
{error && (
<>
<p>Could be due to this error:</p>{" "}
<pre>{JSON.stringify(error)}</pre>
</>
)} */}
<br />
<br />

<Button
variant="contained"
onClick={() => {
dispatch(webSocketActions.establishConnection(modelId));
setFakeTimeout(true);
setTimeout(() => {
setFakeTimeout(false);
setFails(fails + 1);
}, 5000);
}}
>
attempt to reconnect
</Button>
</>
)}
<Button
variant="contained"
onClick={() => {
dispatch(webSocketActions.establishConnection(modelId));
setFakeTimeout(true);
setTimeout(() => {
setFakeTimeout(false);
setFails(fails + 1);
}, 5000);
}}
>
attempt to reconnect
</Button>
</>
)}
</>
</DialogContent>
</Dialog>
);
Expand Down

0 comments on commit ff8a832

Please sign in to comment.