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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fcfbc352ba
commit
05e686dd47
@@ -54,6 +54,7 @@ export function plugin(client: PluginClient<Events>) {
|
||||
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<Events>) {
|
||||
});
|
||||
});
|
||||
|
||||
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<MetadataId, Metadata>,
|
||||
) {
|
||||
@@ -183,6 +194,8 @@ export function plugin(client: PluginClient<Events>) {
|
||||
const snapshot = createState<SnapshotInfo | null>(null);
|
||||
|
||||
const uiState: UIState = {
|
||||
isConnected: createState(false),
|
||||
|
||||
//used to disabled hover effects which cause rerenders and mess up the existing context menu
|
||||
isContextMenuOpen: createState<boolean>(false),
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import {Atom} from 'flipper-plugin';
|
||||
|
||||
export type UIState = {
|
||||
isConnected: Atom<boolean>;
|
||||
isPaused: Atom<boolean>;
|
||||
streamState: Atom<StreamState>;
|
||||
searchTerm: Atom<string>;
|
||||
|
||||
Reference in New Issue
Block a user