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 2021/07/26 16:58:52 UTC

[GitHub] [superset] graceguo-supercat commented on a change in pull request #15891: fix: Run sql picked from History

graceguo-supercat commented on a change in pull request #15891:
URL: https://github.com/apache/superset/pull/15891#discussion_r676783813



##########
File path: superset-frontend/src/SqlLab/components/SqlEditor.jsx
##########
@@ -222,6 +222,15 @@ class SqlEditor extends React.PureComponent {
     });
   }
 
+  static getDerivedStateFromProps(props, state) {
+    if (props.queryEditor.sql !== state.sql) {
+      return {
+        sql: props.queryEditor.sql,
+      };
+    }
+    return null;
+  }

Review comment:
       i think this is a good idea: I removed all the usage for `state.sql` and always use `props.queryEditor.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