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 2020/10/15 21:04:15 UTC

[GitHub] [incubator-superset] rusackas commented on a change in pull request #11216: refactor: Refactor QueryTable to use react-table

rusackas commented on a change in pull request #11216:
URL: https://github.com/apache/incubator-superset/pull/11216#discussion_r505848919



##########
File path: superset-frontend/src/SqlLab/components/QueryTable.jsx
##########
@@ -74,151 +75,162 @@ class QueryTable extends React.PureComponent {
   }
 
   render() {
-    const data = this.props.queries
-      .map(query => {
-        const q = { ...query };
-        if (q.endDttm) {
-          q.duration = fDuration(q.startDttm, q.endDttm);
-        }
-        const time = moment(q.startDttm).format().split('T');
-        q.time = (
-          <div>
-            <span>
-              {time[0]} <br /> {time[1]}
-            </span>
-          </div>
-        );
-        q.user = (
-          <Button
-            buttonSize="small"
-            buttonStyle="link"
-            onClick={this.props.onUserClicked.bind(this, q.userId)}
-          >
-            {q.user}
-          </Button>
-        );
-        q.db = (
-          <Button
-            buttonSize="small"
-            buttonStyle="link"
-            onClick={this.props.onDbClicked.bind(this, q.dbId)}
-          >
-            {q.db}
-          </Button>
-        );
-        q.started = moment(q.startDttm).format('HH:mm:ss');
-        q.querylink = (
-          <div style={{ width: '100px' }}>
+    const data = memoize(() =>

Review comment:
       Mentioned a concern in another PR about the risks of `lodash/memoize` but long story short, it's got issues, and we should _probably_ use `memoize-one` for memoizing in class components OR conver them to function components and go with `useMemo`




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

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