From 42320e1c09401b7df90735168c86d79b31ffd958 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Wed, 3 May 2023 06:24:07 -0700 Subject: [PATCH] Remove focus mode when frame no longer contains previously focused mode Summary: The logic was a little outdated to when we were accumulating subtrees, now its much simpler, if the previously focused id is not in the new frame, remove focus Changelog: UIDebugger, fix focus mode behaviour Reviewed By: mweststrate Differential Revision: D45523026 fbshipit-source-id: 894a85df21cc27eb57dbef411ae57743d0c4f753 --- desktop/plugins/public/ui-debugger/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/plugins/public/ui-debugger/index.tsx b/desktop/plugins/public/ui-debugger/index.tsx index 64791bfa9..742975a60 100644 --- a/desktop/plugins/public/ui-debugger/index.tsx +++ b/desktop/plugins/public/ui-debugger/index.tsx @@ -440,7 +440,7 @@ function uiActions(uiState: UIState, nodes: Atom>): UIActions { function checkFocusedNodeStillActive(uiState: UIState, nodes: Map) { const focusedNodeId = uiState.focusedNode.get(); const focusedNode = focusedNodeId && nodes.get(focusedNodeId); - if (focusedNode && !isFocusedNodeAncestryAllActive(focusedNode, nodes)) { + if (!focusedNode || !isFocusedNodeAncestryAllActive(focusedNode, nodes)) { uiState.focusedNode.set(undefined); } }