yousoph commented on code in PR #40983:
URL: https://github.com/apache/superset/pull/40983#discussion_r3418743322


##########
superset-frontend/src/SqlLab/reducers/sqlLab.ts:
##########
@@ -604,8 +604,17 @@ export default function sqlLabReducer(
     },
     [actions.QUERY_EDITOR_SET_SQL]() {
       const { unsavedQueryEditor } = state;
+      // Normalize tabViewId to client-side id (same pattern as START_QUERY)
+      const queryEditorByTabId = getFromArr(
+        state.queryEditors,
+        action.queryEditor!.id!,
+        'tabViewId',
+      );
+      const normalizedId =
+        (queryEditorByTabId as QueryEditor | undefined)?.id ??
+        action.queryEditor!.id!;

Review Comment:
   Applied — the O(n) scan is now short-circuited when  already matches  (the 
keystroke/common path).  only runs when the ids differ, which is the 
restore-from-history path where  is being passed in.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to