From 3d59d72aaa4a8128b82c1d9d999b5bb3a3a6b71a Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 7 Jun 2017 04:49:41 +0100 Subject: [PATCH] Fixed pagination infinite loop caused by long messages Signed-off-by: Oliver Hunt --- src/components/structures/ScrollPanel.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index a652bcc827..f035efee92 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -352,13 +352,14 @@ module.exports = React.createClass({ const tile = tiles[backwards ? i : tiles.length - 1 - i]; // Subtract height of tile as if it were unpaginated excessHeight -= tile.clientHeight; + //If removing the tile would lead to future pagination, break before setting scroll token + if (tile.clientHeight > excessHeight) { + break; + } // The tile may not have a scroll token, so guard it if (tile.dataset.scrollTokens) { markerScrollToken = tile.dataset.scrollTokens.split(',')[0]; } - if (tile.clientHeight > excessHeight) { - break; - } } if (markerScrollToken) {