From 875a1f70c12a4cd75fe1ef74da2cc3eeaae751da Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Tue, 7 Jul 2020 19:12:01 -0400 Subject: [PATCH] Fix date, index calculation on reload --- js/src/forum/states/PostStreamState.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/forum/states/PostStreamState.js b/js/src/forum/states/PostStreamState.js index 0b4b565ed..a60d588b7 100644 --- a/js/src/forum/states/PostStreamState.js +++ b/js/src/forum/states/PostStreamState.js @@ -125,7 +125,8 @@ class PostStreamState { show(posts) { this.visibleStart = posts.length ? this.discussion.postIds().indexOf(posts[0].id()) : 0; this.visibleEnd = this.sanitizeIndex(this.visibleStart + posts.length); - this.index = (this.visibleEnd - this.visibleStart) / 2; + this.index = (this.visibleEnd + this.visibleStart) / 2; + this.description = posts.length ? dayjs(posts[Math.floor(posts.length / 2)].createdAt()).format('MMMM YYYY') : ''; } /** @@ -138,7 +139,6 @@ class PostStreamState { reset(start, end) { this.visibleStart = start || 0; this.visibleEnd = this.sanitizeIndex(end || this.constructor.loadCount); - this.index = (this.visibleEnd - this.visibleStart) / 2; } /**