Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 736bc7b

Browse files
yeze322cwhitten
andauthored
perf: early return when focused element not changed (#4545)
Co-authored-by: Chris Whitten <[email protected]>
1 parent 19c3be4 commit 736bc7b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Composer/packages/adaptive-flow/src/adaptive-flow-editor/hooks/useEditorEventApi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const useEditorEventApi = (
3939
} = useDialogEditApi(shellApi);
4040
const { createDialog, readDialog, updateDialog } = useDialogApi(shellApi);
4141
const { path, data, nodeContext, selectionContext } = state;
42-
const { focusedId, focusedEvent, clipboardActions, dialogFactory } = nodeContext;
42+
const { focusedId, focusedTab, focusedEvent, clipboardActions, dialogFactory } = nodeContext;
4343
const { selectedIds, setSelectedIds, selectableElements } = selectionContext;
4444

4545
const {
@@ -79,6 +79,7 @@ export const useEditorEventApi = (
7979
switch (eventName) {
8080
case NodeEventTypes.Focus:
8181
handler = (e: { id: string; tab?: string }) => {
82+
if (e.id === focusedId && e.tab === focusedTab) return;
8283
const newFocusedIds = e.id ? [e.id] : [];
8384
setSelectedIds([...newFocusedIds]);
8485
onFocusSteps([...newFocusedIds], e.tab);

0 commit comments

Comments
 (0)