Break connection loop

Summary:
Whenever there was a connectivity error, we would show an error message and setup a retry mechanism as to refresh the page as to make it transparent for engineers to have a working workspace again.

The problem is that there are two different channels:
- HTTP server
- WS server

If the HTTP server is healthy but there is a WS error, it is not entirely correct to try to reload the page. If the error conditions for the WS remain, then we end up in a loop.

Reviewed By: passy, antonk52

Differential Revision: D49373335

fbshipit-source-id: 4e0a08fe2384860db0bf92a22edc87402d41651c
This commit is contained in:
Lorenzo Blasa
2023-09-18 08:57:15 -07:00
committed by Facebook GitHub Bot
parent 9d6c0bd8b0
commit 342ef42114
3 changed files with 7 additions and 38 deletions

View File

@@ -19,6 +19,7 @@ if (loadingContainer) {
let cachedFile: {name: string; data: string} | undefined;
let cachedDeepLinkURL: string | undefined;
let once: boolean = false;
async function start() {
// @ts-ignore
electronRequire = function (path: string) {
@@ -75,7 +76,11 @@ async function start() {
window.flipperShowMessage?.('Connecting to server...');
break;
case FlipperServerState.CONNECTED:
window?.flipperHideMessage?.();
if (once) {
return window.location.reload();
}
once = true;
window.flipperHideMessage?.();
break;
case FlipperServerState.DISCONNECTED:
window?.flipperShowNoConnection?.();