You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/07/26 22:44:15 UTC

[GitHub] [superset] justinpark opened a new pull request, #20877: perf(sqllab): Rendering perf improvement using immutable state

justinpark opened a new pull request, #20877:
URL: https://github.com/apache/superset/pull/20877

   ### SUMMARY
   
   The main rendering in SqlLab is managed by the `queryEditors` state from redux(state machine).
   Each queryEditor state has been updated whenever an editor configuration has updated.
   
   Since most components observes entire queryEditor state not specific attributes, any queryEditor updates trigger multiple repainting even if no visual changes impacted.
   
   For example, when a user types any single character in the ace(sql) editor, it triggers the update for `selectedText` value in the active queryEditor state. This single change will trigger the following components repainted (though this change won't impact the left and bottom panels at all)
   
   <img width="1057" alt="Screen_Shot_2022-07-26_at_3_10_16_PM" src="https://user-images.githubusercontent.com/1392866/181122038-84caef40-9f52-4bdd-83c6-1d473a7c011c.png">
   
   This unrelated repainting job causes the performance delay especially when table list is humongous.
   
   <img width="1055" alt="Screen_Shot_2022-07-26_at_3_24_05_PM" src="https://user-images.githubusercontent.com/1392866/181122746-8f5b4ae4-6d04-4c25-8289-bbde0e668bc3.png">
   
   The delay can be found in the following performance analysis due to the unnecessary repainting/redux post processes.
   
   <img width="1786" alt="Screen_Shot_2022-07-25_at_4_08_35_PM" src="https://user-images.githubusercontent.com/1392866/181123341-7d082ac9-302d-4a32-8219-bade95846908.png">
   
   This commit fixes this performance issue by optimizing observers in each component to subscribe only related items.
   To minimize the existing persistence state, this commit keeps the existing `queryEditors` state but make it immutable during the tab is active and only updates when the tab is switched. It introduces `unsavedQueryEditor` state which stores all these active changes.
   
   With this update, the page rendering performance improved 3.5x faster(from 4.5s to 1.3s) and verified all unnecessary tasks cleaned.
   
   <img width="1816" alt="Screen Shot 2022-07-25 at 4 18 45 PM" src="https://user-images.githubusercontent.com/1392866/181124253-e9d4e4d7-5ea6-4c60-b328-4786277e8583.png">
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before (4.5s):
   
   https://user-images.githubusercontent.com/1392866/181118443-f8949bc1-1d07-4dcb-8a65-aec1ff024fee.mov
   
   After (1.3s):
   
   <img width="1814" alt="Screen_Shot_2022-07-25_at_4_19_14_PM" src="https://user-images.githubusercontent.com/1392866/181118409-b876d22d-2402-4a1f-9634-4e99c1473ca3.png">
   
   
   ### TESTING INSTRUCTIONS
   
   1. Go to SqlLab
   2. Choose a database and a schema that includes a large set of table list
   3. Open chrome console > Performance tab
   4. Select Caption settings on right menu
   5. Change CPU throttling to 6x slowdown
   6. type a string in the sql editor and then watch the refresh icon on the left panel (it will blink during repainting)
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [x] Removes existing feature or API
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] github-actions[bot] commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1206674757

   @hughhhh Ephemeral environment spinning up at http://34.217.110.42:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ktmud commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
ktmud commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1198608887

   /testenv up
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] justinpark commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
justinpark commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r938056113


##########
superset-frontend/src/SqlLab/actions/sqlLab.test.js:
##########
@@ -24,22 +24,21 @@ import thunk from 'redux-thunk';
 import shortid from 'shortid';
 import * as featureFlags from 'src/featureFlags';
 import * as actions from 'src/SqlLab/actions/sqlLab';
-import { defaultQueryEditor, query } from '../fixtures';
+import { defaultQueryEditor, query, initialState } from 'src/SqlLab/fixtures';
 
 const middlewares = [thunk];
 const mockStore = configureMockStore(middlewares);
 
 describe('async actions', () => {
   const mockBigNumber = '9223372036854775807';
   const queryEditor = {
+    ...defaultQueryEditor,
     id: 'abcd',
     autorun: false,
-    dbId: null,
     latestQueryId: null,
-    selectedText: null,
     sql: 'SELECT *\nFROM\nWHERE',
     name: 'Untitled Query 1',
-    schemaOptions: [{ value: 'main', label: 'main', name: 'main' }],
+    schemaOptions: [{ value: 'main', label: 'main', title: 'main' }],

Review Comment:
   @hughhhh This change(title -> name) accidentally happened [here](https://github.com/apache/superset/pull/20852/files#diff-c489b64153b9a09dc1f0984560850db74bf49af1184bfe68b9f258a44b89105aR42) while the PR made the change for queryEditor title to name.
   
   cc: @lyndsiWilliams 
   
   I reverted this change to pass the type role since I'm following [this type definition](https://github.com/apache/superset/blob/master/superset-frontend/src/SqlLab/components/SaveQuery/index.tsx#L50)
   
   and it's also allocated as `title` here:
   
   https://github.com/apache/superset/blob/eb5369f2a6f2dc238838119eb70194bf2b42b085/superset-frontend/src/components/DatabaseSelector/index.tsx#L224-L228
   



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] justinpark commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
justinpark commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1218604019

   @eschutho I updated the commit. Can you review the update? thanks!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] justinpark commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
justinpark commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r939343751


##########
superset-frontend/src/SqlLab/components/SaveQuery/index.tsx:
##########
@@ -178,7 +193,9 @@ export default function SaveQuery({
         onHide={() => setShowSaveDatasetModal(false)}
         buttonTextOnSave={t('Save & Explore')}
         buttonTextOnOverwrite={t('Overwrite & Explore')}
-        datasource={getDatasourceAsSaveableDataset(query)}
+        datasource={
+          getDatasourceAsSaveableDataset(query) as any as ISaveableDatasource

Review Comment:
   oh it needed this custom type cast but no longer needed. I reverted this change.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r940726057


##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -620,6 +677,7 @@ export function switchQueryEditor(queryEditor, displayLimit) {
   return function (dispatch) {
     if (
       isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE) &&
+      queryEditor &&

Review Comment:
   maybe use optional chaining here as well?



##########
superset-frontend/src/SqlLab/App.jsx:
##########
@@ -91,6 +94,12 @@ const sqlLabPersistStateConfig = {
       const result = {
         ...initialState,
         ...persistedState,
+        sqlLab: {
+          ...(persistedState && persistedState.sqlLab),

Review Comment:
   if `persistedState` is null or undefined, this will error when you try to spread it. I'd recommend a default of an empty object.. maybe something like 
   ```suggestion
             ...(persistedState?.sqlLab || {}),
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] justinpark commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
justinpark commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1196961111

   /testenv up


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] hughhhh commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
hughhhh commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r938004610


##########
superset-frontend/src/SqlLab/actions/sqlLab.test.js:
##########
@@ -24,22 +24,21 @@ import thunk from 'redux-thunk';
 import shortid from 'shortid';
 import * as featureFlags from 'src/featureFlags';
 import * as actions from 'src/SqlLab/actions/sqlLab';
-import { defaultQueryEditor, query } from '../fixtures';
+import { defaultQueryEditor, query, initialState } from 'src/SqlLab/fixtures';
 
 const middlewares = [thunk];
 const mockStore = configureMockStore(middlewares);
 
 describe('async actions', () => {
   const mockBigNumber = '9223372036854775807';
   const queryEditor = {
+    ...defaultQueryEditor,
     id: 'abcd',
     autorun: false,
-    dbId: null,
     latestQueryId: null,
-    selectedText: null,
     sql: 'SELECT *\nFROM\nWHERE',
     name: 'Untitled Query 1',
-    schemaOptions: [{ value: 'main', label: 'main', name: 'main' }],
+    schemaOptions: [{ value: 'main', label: 'main', title: 'main' }],

Review Comment:
   why are we changing this to `title`



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] github-actions[bot] commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1203313659

   @ktmud Ephemeral environment spinning up at http://34.217.34.22:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ktmud commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
ktmud commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1203304909

   /testenv up


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] EugeneTorap commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
EugeneTorap commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1224219364

   @eschutho @michael-s-molina Can we merge the PR?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r940735372


##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -357,15 +371,58 @@ export function runQuery(query) {
   };
 }
 
+export function runQueryFromSqlEditor(
+  database,
+  queryEditor,
+  defaultQueryLimit,
+  tempTable,
+  ctas,
+  ctasMethod,
+) {
+  return function (dispatch, getState) {
+    const qe = getUpToDateQuery(getState(), queryEditor, queryEditor.id);
+    const query = {
+      dbId: qe.dbId,
+      sql: qe.selectedText ? qe.selectedText : qe.sql,

Review Comment:
   nit:
   ```suggestion
         sql: qe.selectedText || qe.sql,
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] hughhhh commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
hughhhh commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r939009284


##########
superset-frontend/src/SqlLab/components/SaveQuery/index.tsx:
##########
@@ -178,7 +193,9 @@ export default function SaveQuery({
         onHide={() => setShowSaveDatasetModal(false)}
         buttonTextOnSave={t('Save & Explore')}
         buttonTextOnOverwrite={t('Overwrite & Explore')}
-        datasource={getDatasourceAsSaveableDataset(query)}
+        datasource={
+          getDatasourceAsSaveableDataset(query) as any as ISaveableDatasource

Review Comment:
   why are casting as `any` and then `ISaveableDatasource` here



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] justinpark commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
justinpark commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r948161323


##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -620,6 +677,7 @@ export function switchQueryEditor(queryEditor, displayLimit) {
   return function (dispatch) {
     if (
       isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE) &&
+      queryEditor &&

Review Comment:
   sounds good



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] github-actions[bot] commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1198610517

   @ktmud Ephemeral environment spinning up at http://34.220.154.64:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] github-actions[bot] commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1197080069

   @justinpark Ephemeral environment creation is currently limited to committers.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] hughhhh commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
hughhhh commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1206667491

   /testenv up


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] eschutho commented on a diff in pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
eschutho commented on code in PR #20877:
URL: https://github.com/apache/superset/pull/20877#discussion_r942877780


##########
superset-frontend/src/SqlLab/components/SqlEditorTabHeader/index.tsx:
##########
@@ -0,0 +1,146 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React, { useMemo } from 'react';
+import { bindActionCreators } from 'redux';
+import { useSelector, useDispatch, shallowEqual } from 'react-redux';
+import { Dropdown } from 'src/components/Dropdown';
+import { Menu } from 'src/components/Menu';
+import { styled, t, QueryState } from '@superset-ui/core';
+import {
+  removeQueryEditor,
+  removeAllOtherQueryEditors,
+  queryEditorSetTitle,
+  cloneQueryToNewTab,
+  toggleLeftBar,
+} from 'src/SqlLab/actions/sqlLab';
+import { QueryEditor, SqlLabRootState } from 'src/SqlLab/types';
+import TabStatusIcon from '../TabStatusIcon';
+
+const TabTitleWrapper = styled.div`
+  display: flex;
+  align-items: center;
+`;
+const TabTitle = styled.span`
+  margin-right: ${({ theme }) => theme.gridUnit * 2}px;
+  text-transform: none;
+`;
+
+interface Props {
+  queryEditor: QueryEditor;
+}
+
+const SqlEditorTabHeader: React.FC<Props> = ({ queryEditor }) => {
+  const qe = useSelector<SqlLabRootState, QueryEditor>(
+    ({ sqlLab: { unsavedQueryEditor } }) => ({
+      ...queryEditor,
+      ...(queryEditor.id === unsavedQueryEditor.id && unsavedQueryEditor),
+    }),
+    shallowEqual,
+  );
+  const queryStatus = useSelector<SqlLabRootState, QueryState>(
+    ({ sqlLab }) => sqlLab.queries[qe.latestQueryId || '']?.state || '',
+  );
+  const dispatch = useDispatch();
+  const actions = useMemo(
+    () =>
+      bindActionCreators(
+        {
+          removeQueryEditor,
+          removeAllOtherQueryEditors,
+          queryEditorSetTitle,
+          cloneQueryToNewTab,
+          toggleLeftBar,
+        },
+        dispatch,
+      ),
+    [dispatch],
+  );
+
+  function renameTab() {
+    const newTitle = prompt(t('Enter a new title for the tab'));
+    if (newTitle) {
+      actions.queryEditorSetTitle(qe, newTitle);
+    }
+  }
+
+  return (
+    <TabTitleWrapper>
+      <Dropdown

Review Comment:
   Not sure if this was expected, but can we bring back the `trigger={['click']}` on this component, too?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1196126049

   # [Codecov](https://codecov.io/gh/apache/superset/pull/20877?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#20877](https://codecov.io/gh/apache/superset/pull/20877?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c1bea8) into [master](https://codecov.io/gh/apache/superset/commit/6b0c3032b28a606fedefa7552823c6e18a95a563?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6b0c303) will **increase** coverage by `0.05%`.
   > The diff coverage is `62.85%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #20877      +/-   ##
   ==========================================
   + Coverage   66.26%   66.31%   +0.05%     
   ==========================================
     Files        1757     1758       +1     
     Lines       66935    66998      +63     
     Branches     7101     7121      +20     
   ==========================================
   + Hits        44353    44430      +77     
   + Misses      20767    20741      -26     
   - Partials     1815     1827      +12     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `52.03% <62.85%> (+0.12%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/20877?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (ø)` | |
   | [...d/src/SqlLab/components/TabbedSqlEditors/index.jsx](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RhYmJlZFNxbEVkaXRvcnMvaW5kZXguanN4) | `55.93% <ø> (-0.19%)` | :arrow_down: |
   | [superset-frontend/src/SqlLab/types.ts](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi90eXBlcy50cw==) | `57.14% <ø> (ø)` | |
   | [...et-frontend/src/components/TableSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGFibGVTZWxlY3Rvci9pbmRleC50c3g=) | `78.26% <ø> (+2.17%)` | :arrow_up: |
   | [...frontend/src/SqlLab/components/SqlEditor/index.jsx](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1NxbEVkaXRvci9pbmRleC5qc3g=) | `49.73% <37.50%> (-1.64%)` | :arrow_down: |
   | [...c/SqlLab/components/TemplateParamsEditor/index.tsx](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RlbXBsYXRlUGFyYW1zRWRpdG9yL2luZGV4LnRzeA==) | `82.35% <50.00%> (+7.35%)` | :arrow_up: |
   | [...et-frontend/src/SqlLab/reducers/getInitialState.js](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9nZXRJbml0aWFsU3RhdGUuanM=) | `46.66% <50.00%> (+0.23%)` | :arrow_up: |
   | [superset-frontend/src/SqlLab/reducers/sqlLab.js](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9zcWxMYWIuanM=) | `34.91% <50.00%> (+1.57%)` | :arrow_up: |
   | [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `62.29% <57.14%> (+1.85%)` | :arrow_up: |
   | [...d/src/SqlLab/components/SqlEditorLeftBar/index.tsx](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1NxbEVkaXRvckxlZnRCYXIvaW5kZXgudHN4) | `50.00% <66.66%> (+0.79%)` | :arrow_up: |
   | ... and [30 more](https://codecov.io/gh/apache/superset/pull/20877/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] github-actions[bot] commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1224221519

   Ephemeral environment shutdown and build artifacts deleted.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] michael-s-molina merged pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
michael-s-molina merged PR #20877:
URL: https://github.com/apache/superset/pull/20877


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ktmud commented on pull request #20877: perf(sqllab): Rendering perf improvement using immutable state

Posted by GitBox <gi...@apache.org>.
ktmud commented on PR #20877:
URL: https://github.com/apache/superset/pull/20877#issuecomment-1197505665

   
   /testenv up
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org