Prevent readFragment from breaking when run is in progress
@@ -39,17 +39,25 @@ class Log extends React.Component {
};
componentDidMount() {
+ this.scrollToBottom();
+ }
+
+ componentWillReceiveProps(nextProps) {
+ if (nextProps.logLines) {
+ // Bind stream only when `logLines` is not empty, and only once,
+ // otherwise `readFragment` will break.
+ // As an alternative, we can go with unbinding all events from `StreamingLog`
+ if (!this.bound) {
this.props.stream(
this.props.client,
this.props.match.params,
this.props.bucket,
this.updateCallback,
);
- this.scrollToBottom();
+ this.bound = true;
}
- componentWillReceiveProps(nextProps) {
- if (nextProps.logLines && this.props.logLines !== nextProps.logLines) {
+ if (this.props.logLines !== nextProps.logLines) {
//TODO: WTF
if (this.props.updateLoss) {
this.props.updateLoss(
@@ -59,6 +67,7 @@ class Log extends React.Component {
}
}
}
+ }
componentDidUpdate(prevProps, prevState) {
if (
