From d20650fb4294dec492a087a67f14a28b96c62ef9 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Tue, 7 Jul 2020 19:12:43 -0400 Subject: [PATCH] Use date of the post in index --- js/src/forum/components/PostStream.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js/src/forum/components/PostStream.js b/js/src/forum/components/PostStream.js index 0c72b2253..e502624d2 100644 --- a/js/src/forum/components/PostStream.js +++ b/js/src/forum/components/PostStream.js @@ -208,16 +208,15 @@ export default class PostStream extends Component { const coversQuarterOfViewport = (height - visibleTop) / viewportHeight > 0.25; if (index === undefined && (threeQuartersVisible || coversQuarterOfViewport)) { index = parseFloat($this.data('index')) + visibleTop / height; + // If this item has a time associated with it, then set the + // scrollbar's current period to a formatted version of this time. + const time = $this.data('time'); + if (time) period = time; } if (visiblePost > 0) { visible += visiblePost / height; } - - // If this item has a time associated with it, then set the - // scrollbar's current period to a formatted version of this time. - const time = $this.data('time'); - if (time) period = time; }); const indexChanged = Math.floor(this.state.index) != Math.floor(index);