Remove troubleshoot from here

Summary:
Simplify how messages (state updates) are shown in Flipper UI.

This main change was introduced as a way to show the 'Start' server button whenever we were in a disconnected state. This is not as simple as the server may be restarting or the client may be even have reset the WS connection. Hence you the experience where this UI is shown and immediately dismissed.

This UI is only ever shown if at one point the server was alive, period. So, in this case, either the server becomes available again OR the user quits the PWA/tab/browser and launches again.

IMHO, this is a better experience that totally assuming the server is dead.

In a next iteration, we can be more clever and have a timeout such that if after a set period of time the server doesn't become online, then we show a button to start (or force kill) the server.

Reviewed By: aigoncharov

Differential Revision: D49915698

fbshipit-source-id: 03fcc150ed1f1303d1d727c82a71eb32616208e8
This commit is contained in:
Lorenzo Blasa
2023-10-05 04:37:16 -07:00
committed by Facebook GitHub Bot
parent 0e90873096
commit d9ad2a8932
4 changed files with 36 additions and 197 deletions

View File

@@ -19,6 +19,5 @@ declare global {
flipperShowMessage?(message: string): void;
flipperHideMessage?(): void;
flipperShowNoConnection?(): void;
}
}

View File

@@ -78,7 +78,7 @@ async function start() {
window.flipperHideMessage?.();
break;
case FlipperServerState.DISCONNECTED:
window?.flipperShowNoConnection?.();
window.flipperShowMessage?.('Waiting for server...');
break;
}
},
@@ -98,13 +98,6 @@ async function start() {
initializeRenderHost(flipperServer, flipperServerConfig);
initializePWA();
// By turning this in a require, we force the JS that the body of this module (init) has completed (initializeElectron),
// before starting the rest of the Flipper process.
// This prevent issues where the render host is referred at module initialisation level,
// but not set yet, which might happen when using normal imports.
// TODO: remove
window.flipperShowMessage?.('Connected to Flipper Server successfully');
// @ts-ignore
// eslint-disable-next-line import/no-commonjs
require('flipper-ui-core').startFlipperDesktop(flipperServer);
@@ -113,7 +106,7 @@ async function start() {
start().catch((e) => {
console.error('Failed to start flipper-ui-browser', e);
window.flipperShowMessage?.('Failed to start flipper-ui-browser: ' + e);
window.flipperShowMessage?.('Failed to start UI with error: ' + e);
});
async function initializePWA() {