From 23ebd8b8651050387341ef4ddb3d1cb01c2767c9 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Wed, 10 May 2023 05:05:34 -0700 Subject: [PATCH] Change logic for generating debug wrapper for nodes Summary: Previously we would only generate debug wrapper for render core layout result when uidebugger was currently connected. This meant if you navigate to a bloks screen *before* having the ui debugger open at render time it would read ui debugger as disconnected since the ui debugger is not a background plugin. The result is the user would see the native nodes instead of the bound tree, it was extra confusing since the layout result was cached so going forward and back doesnt solve it. The ideal solution would be to have a global flipper is connected on the client but this isnt available yet, lorenzo said he would work on it later. As a work around we use the fact that the uidebugger has ever been connected in this session. It can still be confusing since the initial load of a bloks screen migt not generate the debug nodes until you navigate to the plugin once. I will add a note to the docs so say that you need to have open the uidebugger once before nodes will appear Reviewed By: mweststrate Differential Revision: D45605120 fbshipit-source-id: 970943b9f8f98221b7fc5e20bb1caf18c2266474 --- .../plugins/uidebugger/UIDebuggerFlipperPlugin.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt index 94d3fcb19..487c6d557 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt @@ -31,9 +31,7 @@ class UIDebuggerFlipperPlugin(val context: UIDContext) : FlipperPlugin { @Throws(Exception::class) override fun onConnect(connection: FlipperConnection) { - isConnected = true - - Log.i(LogTag, "Connected") + hasConnectedPreviously = true this.context.connectionRef.connection = connection this.context.bitmapPool.makeReady() @@ -56,9 +54,7 @@ class UIDebuggerFlipperPlugin(val context: UIDContext) : FlipperPlugin { @Throws(Exception::class) override fun onDisconnect() { - isConnected = false this.context.connectionRef.connection = null - Log.i(LogTag, "Disconnected") MetadataRegister.reset() @@ -71,7 +67,8 @@ class UIDebuggerFlipperPlugin(val context: UIDContext) : FlipperPlugin { } companion object { - var isConnected: Boolean = false + + var hasConnectedPreviously: Boolean = false private set } }