Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 6469659

Browse files
committed
Add shouldComponentUpdate to JobShowComponent.
1 parent 2879389 commit 6469659

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/views/2_SessionComponent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class SessionComponent extends React.Component<Props, {}> {
5353
<JobShowComponent
5454
key={job.id}
5555
job={job}
56+
jobStatus={job.status}
5657
isFocused={this.props.isFocused && index === this.props.session.jobs.length - 1}
5758
/>,
5859
);

src/views/3_JobShowComponent.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import * as React from "react";
22
import {Job} from "../shell/Job";
33
import {BufferComponent} from "./BufferComponent";
44
import {JobHeaderComponent} from "./JobHeaderComponent";
5+
import {Status} from "../Enums";
56

67
interface Props {
78
job: Job;
9+
jobStatus: Status;
810
isFocused: boolean;
911
}
1012

@@ -27,6 +29,12 @@ export class JobShowComponent extends React.Component<Props, State> {
2729
.on("status", () => this.forceUpdate());
2830
}
2931

32+
shouldComponentUpdate(nextProps: Props, nextState: State) {
33+
return this.state.decorate !== nextState.decorate ||
34+
this.props.jobStatus === Status.InProgress ||
35+
this.props.jobStatus !== nextProps.jobStatus;
36+
}
37+
3038
render() {
3139
let buffer: React.ReactElement<any>;
3240
let canBeDecorated = this.props.job.canBeDecorated();

0 commit comments

Comments
 (0)