1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 17:36:38 +02:00

do not use custom route resolver solution for plain index page

This commit is contained in:
David Sevilla Martin
2020-08-12 20:45:22 -04:00
committed by Franz Liedke
parent b78db0268a
commit 7d5bebb70a
2 changed files with 17 additions and 7 deletions

View File

@@ -29,23 +29,33 @@ export default class IndexPage extends Page {
this.lastDiscussion = app.previous.get('discussion');
}
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';
this.currentPath = m.route.get();
}
static onroutematch() {
// 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.current.matches(IndexPage)) {
onbeforeupdate(vnode) {
super.onbeforeupdate(vnode);
const curPath = m.route.get();
if (this.currentPath !== curPath) {
app.discussions.clear();
app.discussions.refreshParams(app.search.params());
this.currentPath = curPath;
}
console.log('IndexPage#onbeforeupdate');
}
view() {

View File

@@ -21,7 +21,7 @@ const match = (component) => ({
*/
export default function (app) {
app.routes = {
index: { path: '/all', component: match(IndexPage) },
index: { path: '/all', component: IndexPage },
discussion: { path: '/d/:id', component: DiscussionPage },
'discussion.near': { path: '/d/:id/:near', component: DiscussionPage },