Skip to content

Commit

Permalink
Resolves TypeError: Cannot read property viewRangeLength of undefined
Browse files Browse the repository at this point in the history
Fixes eclipse-cdt-cloud#104

Signed-off-by: Ankush Tyagi <ankush.tyagi@ericsson.com>
  • Loading branch information
ankusht-work committed Feb 10, 2021
1 parent 89eecee commit 779311e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions timeline-chart/src/layer/time-graph-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TimelineChart } from "../time-graph-model";
import { TimeGraphComponent, TimeGraphRect, TimeGraphStyledRect } from "../components/time-graph-component";
import { TimeGraphChartLayer } from "./time-graph-chart-layer";
import { TimeGraphRowController } from "../time-graph-row-controller";
import { TimeGraphUnitController } from "../time-graph-unit-controller";
import { TimeGraphAnnotationComponent, TimeGraphAnnotationComponentOptions, TimeGraphAnnotationStyle } from "../components/time-graph-annotation";

export interface TimeGraphRowElementMouseInteractions {
Expand Down Expand Up @@ -41,6 +42,7 @@ export class TimeGraphChart extends TimeGraphChartLayer {
protected rowElementMouseInteractions: TimeGraphRowElementMouseInteractions;
protected selectedElementModel: TimelineChart.TimeGraphState;
protected selectedElementChangedHandler: ((el: TimelineChart.TimeGraphState) => void)[] = [];
protected unitController: TimeGraphUnitController;

protected providedRange: TimelineChart.TimeGraphRange;
protected providedResolution: number;
Expand Down Expand Up @@ -172,14 +174,16 @@ export class TimeGraphChart extends TimeGraphChartLayer {
this.maybeFetchNewData();
}
});
if (this.unitController.viewRangeLength) {
if (this.unitController.viewRangeLength && this.stateController.canvasDisplayWidth) {
this.maybeFetchNewData();
}
}

updateChart() {
const update = true;
this.maybeFetchNewData(update);
if (this.unitController && this.stateController) {
this.maybeFetchNewData(update);
}
}

update() {
Expand Down

0 comments on commit 779311e

Please sign in to comment.