diff --git a/framework/core/js/forum/src/components/IndexPage.js b/framework/core/js/forum/src/components/IndexPage.js index 5f9eeef2e..baddf654d 100644 --- a/framework/core/js/forum/src/components/IndexPage.js +++ b/framework/core/js/forum/src/components/IndexPage.js @@ -35,12 +35,25 @@ export default class IndexPage extends Component { app.cache.discussionList = null; } - if (!app.cache.discussionList) { - app.cache.discussionList = new DiscussionList({ - params: this.params() + const params = this.params(); + + if (app.cache.discussionList) { + // Compare the requested parameters (sort, search query) to the ones that + // are currently present in the cached discussion list. If they differ, we + // will clear the cache and set up a new discussion list component with + // the new parameters. + Object.keys(params).some(key => { + if (app.cache.discussionList.props.params[key] !== params[key]) { + app.cache.discussionList = null; + return true; + } }); } + if (!app.cache.discussionList) { + app.cache.discussionList = new DiscussionList({params}); + } + app.history.push('index'); app.current = this; app.drawer.hide();