Copilot commented on code in PR #35992:
URL: https://github.com/apache/superset/pull/35992#discussion_r2495654218


##########
superset-frontend/src/SqlLab/reducers/sqlLab.js:
##########
@@ -223,7 +223,9 @@ export default function sqlLabReducer(state = {}, action) {
       // for new table, associate Id of query for data preview
       at.dataPreviewQueryId = null;
       let newState = addToArr(state, 'tables', at, Boolean(action.prepend));
-      newState.activeSouthPaneTab = at.id;
+      if (at.expanded) {
+        newState.activeSouthPaneTab = at.id;
+      }

Review Comment:
   The logic for setting `activeSouthPaneTab` when `at.expanded` is true is now 
duplicated in two places within the same reducer case (lines 218-220 for 
existing tables and lines 226-228 for new tables). Consider extracting this 
logic to avoid duplication. For example: `return { ...newState, ...(at.expanded 
&& { activeSouthPaneTab: at.id }) };` at the end of the reducer case.



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