From 95b7051b02095bbf0e4d7e4824bff322f511e2dd Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson <pkelleydotson@yahoo.com>
Date: Thu, 20 Oct 2022 17:00:07 -0700
Subject: [PATCH 1/3] fix for control x

---
 .../src/SqlLab/components/SqlEditor/index.jsx  | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index 6ff9877cfb4af..a2efdb781de1f 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -174,7 +174,7 @@ const SqlEditor = ({
         database: databases[dbId],
         latestQuery: queries[latestQueryId],
         hideLeftBar,
-      };
+      }
     },
   );
 
@@ -219,6 +219,7 @@ const SqlEditor = ({
     if (latestQuery && ['running', 'pending'].indexOf(latestQuery.state) >= 0) {
       dispatch(postStopQuery(latestQuery));
     }
+    return false;
   };
 
   const runQuery = () => {
@@ -244,7 +245,6 @@ const SqlEditor = ({
   const getHotkeyConfig = () => {
     // Get the user's OS
     const userOS = detectOS();
-
     const base = [
       {
         name: 'runQuery1',
@@ -326,17 +326,21 @@ const SqlEditor = ({
     window.addEventListener('resize', handleWindowResizeWithThrottle);
     window.addEventListener('beforeunload', onBeforeUnload);
 
+    return () => {
+      window.removeEventListener('resize', handleWindowResizeWithThrottle);
+      window.removeEventListener('beforeunload', onBeforeUnload);
+    };
+  }, []);
+
+  useEffect(()=> {
     // setup hotkeys
+    Mousetrap.reset();
     const hotkeys = getHotkeyConfig();
     hotkeys.forEach(keyConfig => {
       Mousetrap.bind([keyConfig.key], keyConfig.func);
     });
 
-    return () => {
-      window.removeEventListener('resize', handleWindowResizeWithThrottle);
-      window.removeEventListener('beforeunload', onBeforeUnload);
-    };
-  }, []);
+  }, [latestQuery])
 
   const onResizeStart = () => {
     // Set the heights on the ace editor and the ace content area after drag starts

From 2790ebb490180fe038e3d042e1d71f4f59044b56 Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson <pkelleydotson@yahoo.com>
Date: Thu, 20 Oct 2022 18:43:45 -0700
Subject: [PATCH 2/3] fix lint

---
 superset-frontend/src/SqlLab/components/SqlEditor/index.jsx | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index a2efdb781de1f..fbfbc51e6d622 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -174,7 +174,7 @@ const SqlEditor = ({
         database: databases[dbId],
         latestQuery: queries[latestQueryId],
         hideLeftBar,
-      }
+      };
     },
   );
 
@@ -332,14 +332,13 @@ const SqlEditor = ({
     };
   }, []);
 
-  useEffect(()=> {
+  useEffect(() => {
     // setup hotkeys
     Mousetrap.reset();
     const hotkeys = getHotkeyConfig();
     hotkeys.forEach(keyConfig => {
       Mousetrap.bind([keyConfig.key], keyConfig.func);
     });
-
   }, [latestQuery])
 
   const onResizeStart = () => {

From 91b6f975e11006b1de83725fa12cb6e59277ccdc Mon Sep 17 00:00:00 2001
From: Phillip Kelley-Dotson <pkelleydotson@yahoo.com>
Date: Fri, 21 Oct 2022 00:07:37 -0700
Subject: [PATCH 3/3] ugh more lint

---
 superset-frontend/src/SqlLab/components/SqlEditor/index.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index fbfbc51e6d622..4db8c748a5dbd 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -339,7 +339,7 @@ const SqlEditor = ({
     hotkeys.forEach(keyConfig => {
       Mousetrap.bind([keyConfig.key], keyConfig.func);
     });
-  }, [latestQuery])
+  }, [latestQuery]);
 
   const onResizeStart = () => {
     // Set the heights on the ace editor and the ace content area after drag starts