handle undefined nextProps.logArray
[ERROR - io.jenkins.blueocean.dashboard.karaoke.Pager.Pipeline] Error fetching page TypeError: newArray.slice is not a function
at LogConsole.componentWillReceiveProps (jenkins-js-extension.js:93336)
at ReactCompositeComponentWrapper.updateComponent (jenkins-design-language.js:49436)
@@ -75,8 +75,11 @@ export class LogConsole extends Component {
componentWillReceiveProps(nextProps) {
// eslint-disable-line
logger.debug('newProps isArray', Array.isArray(nextProps.logArray));
+ if (nextProps.logArray === undefined)
+ return;
+
// We need a shallow copy of the ObservableArray to "cast" it down to normal array
- const newArray = nextProps.logArray !== undefined && nextProps.logArray.slice();
+ const newArray = nextProps.logArray.slice();
const oldArray = this.props.logArray !== undefined && this.props.logArray.slice();
// if have a new logArray, simply add it to the queue and wait for next tick
this.queuedLines = this.queuedLines.concat(newArray.slice(oldArray.length));
