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
This commit is contained in:
Luke De Feo
2023-05-03 06:24:07 -07:00
committed by Facebook GitHub Bot
parent f4e02f04ca
commit 42320e1c09

View File

@@ -440,7 +440,7 @@ function uiActions(uiState: UIState, nodes: Atom<Map<Id, UINode>>): UIActions {
function checkFocusedNodeStillActive(uiState: UIState, nodes: Map<Id, UINode>) {
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);
}
}