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
This commit is contained in:
Luke De Feo
2023-05-10 05:05:34 -07:00
committed by Facebook GitHub Bot
parent fdd1a9e887
commit 23ebd8b865

View File

@@ -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
}
}