From 759eb80ff91f3472bbee32d7bac5ae4b827443b4 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Sun, 4 Oct 2020 22:00:11 -0400 Subject: [PATCH] Remove redundant code from IndexPage oninit --- js/src/forum/components/IndexPage.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/js/src/forum/components/IndexPage.js b/js/src/forum/components/IndexPage.js index e74551976..57f13bc96 100644 --- a/js/src/forum/components/IndexPage.js +++ b/js/src/forum/components/IndexPage.js @@ -29,16 +29,6 @@ export default class IndexPage extends Page { this.lastDiscussion = app.previous.get('discussion'); } - // If the user is coming from the discussion list, then they have either - // just switched one of the parameters (filter, sort, search) or they - // probably want to refresh the results. We will clear the discussion list - // cache so that results are reloaded. - if (app.previous.matches(IndexPage)) { - app.discussions.clear(); - } - - app.discussions.refreshParams(app.search.params()); - app.history.push('index', app.translator.trans('core.forum.header.back_to_index_tooltip')); this.bodyClass = 'App--index'; @@ -47,7 +37,13 @@ export default class IndexPage extends Page { onNewRoute() { super.onNewRoute(); - app.discussions.clear(); + // If the user is coming from the discussion list, then they have either + // just switched one of the parameters (filter, sort, search) or they + // probably want to refresh the results. We will clear the discussion list + // cache so that results are reloaded. + if (app.previous.matches(IndexPage)) { + app.discussions.clear(); + } app.discussions.refreshParams(app.search.params());