kgabryje commented on a change in pull request #11216:
URL:
https://github.com/apache/incubator-superset/pull/11216#discussion_r506251955
##########
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:
I refactored it into functional component
##########
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:
I refactored it into functional component. Feels better
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]