From 062d3e85835345dfdde495d908a75f1801f7c047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juho=20H=C3=A4nninen?= Date: Tue, 10 May 2022 14:59:56 +0300 Subject: [PATCH] MM-381 Fix infinite render loop with diagram --- src/components/stopPoster/stopPoster.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/stopPoster/stopPoster.js b/src/components/stopPoster/stopPoster.js index 23f62ca4..2344ba4e 100644 --- a/src/components/stopPoster/stopPoster.js +++ b/src/components/stopPoster/stopPoster.js @@ -58,9 +58,6 @@ class StopPoster extends Component { adsPhase: false, diagramOptions: defaultDiagramOptions, }; - } - - componentWillMount() { renderQueue.add(this); } @@ -193,6 +190,11 @@ class StopPoster extends Component { // TODO: This is kind of dirty fix. Binarysearch to get acceptable // height for routetree. const { diagramOptions } = this.state; + + if (diagramOptions.heightValues.length === 0) { + this.setState({ hasDiagram: false }); + return; + } diagramOptions.binarySearching = true; diagramOptions.middleHeightValue = diagramOptions.heightValues[Math.floor(diagramOptions.heightValues.length / 2)];