From 6508e64f55d96deb94f5013043b341671761327f Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Fri, 25 Sep 2020 15:54:54 -0400 Subject: [PATCH] DiscussionPage: only set `this.discussion` after the initial set of posts has loaded, this results in a slightly smoother initial load. --- js/src/forum/components/DiscussionPage.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/src/forum/components/DiscussionPage.js b/js/src/forum/components/DiscussionPage.js index b168a68a0..6fc97119e 100644 --- a/js/src/forum/components/DiscussionPage.js +++ b/js/src/forum/components/DiscussionPage.js @@ -160,10 +160,8 @@ export default class DiscussionPage extends Page { * @param {Discussion} discussion */ show(discussion) { - this.discussion = discussion; - app.history.push('discussion', discussion.title()); - app.setTitle(this.discussion.title()); + app.setTitle(discussion.title()); app.setTitleCount(0); // When the API responds with a discussion, it will also include a number of @@ -194,10 +192,12 @@ export default class DiscussionPage extends Page { // posts we want to display. Tell the stream to scroll down and highlight // the specific post that was routed to. this.stream = new PostStreamState(discussion, includedPosts); - this.stream.goToNumber(m.route.param('near') || (includedPosts[0] && includedPosts[0].number()), true); + this.stream.goToNumber(m.route.param('near') || (includedPosts[0] && includedPosts[0].number()), true).then(() => { + this.discussion = discussion; - app.current.set('discussion', discussion); - app.current.set('stream', this.stream); + app.current.set('discussion', discussion); + app.current.set('stream', this.stream); + }); } /**