From 05e686dd4720ad3e4a0432c68667c0bda3eee1a3 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Tue, 27 Jun 2023 04:06:17 -0700 Subject: [PATCH] Added state tracking around init and connected events Summary: Im concerned that we are gettign disconnected without realising, this should help with the logs Reviewed By: lblasa Differential Revision: D47053321 fbshipit-source-id: 1014a3e856517e234f0f79f2a4692f18397fc457 --- desktop/plugins/public/ui-debugger/index.tsx | 13 +++++++++++++ desktop/plugins/public/ui-debugger/types.tsx | 1 + 2 files changed, 14 insertions(+) diff --git a/desktop/plugins/public/ui-debugger/index.tsx b/desktop/plugins/public/ui-debugger/index.tsx index a533ecc7a..949309284 100644 --- a/desktop/plugins/public/ui-debugger/index.tsx +++ b/desktop/plugins/public/ui-debugger/index.tsx @@ -54,6 +54,7 @@ export function plugin(client: PluginClient) { const os = client.device.os; client.onMessage('init', (event) => { + console.log('[ui-debugger] init'); rootId.set(event.rootId); uiState.frameworkEventMonitoring.update((draft) => { event.frameworkEventMetadata?.forEach((frameworkEventMeta) => { @@ -62,6 +63,16 @@ export function plugin(client: PluginClient) { }); }); + client.onConnect(() => { + uiState.isConnected.set(true); + console.log('[ui-debugger] connected'); + }); + + client.onDisconnect(() => { + uiState.isConnected.set(false); + console.log('[ui-debugger] disconnected'); + }); + async function processMetadata( incomingMetadata: Record, ) { @@ -183,6 +194,8 @@ export function plugin(client: PluginClient) { const snapshot = createState(null); const uiState: UIState = { + isConnected: createState(false), + //used to disabled hover effects which cause rerenders and mess up the existing context menu isContextMenuOpen: createState(false), diff --git a/desktop/plugins/public/ui-debugger/types.tsx b/desktop/plugins/public/ui-debugger/types.tsx index 1c86b1353..56ddf5be1 100644 --- a/desktop/plugins/public/ui-debugger/types.tsx +++ b/desktop/plugins/public/ui-debugger/types.tsx @@ -10,6 +10,7 @@ import {Atom} from 'flipper-plugin'; export type UIState = { + isConnected: Atom; isPaused: Atom; streamState: Atom; searchTerm: Atom;