mirror of
https://github.com/flarum/core.git
synced 2025-08-07 08:56:38 +02:00
IndexPage: change routeName on app.current
This commit is contained in:
committed by
Franz Liedke
parent
fb2b0a1d3e
commit
554c72c6db
@@ -11,7 +11,9 @@ export default class Page extends Component {
|
||||
super.oninit(vnode);
|
||||
|
||||
app.previous = app.current;
|
||||
app.current = new PageState(this.constructor, { routeName: vnode.attrs.routeName });
|
||||
app.current = new PageState(this.constructor);
|
||||
|
||||
this.onNewRoute();
|
||||
|
||||
app.drawer.hide();
|
||||
app.modal.close();
|
||||
@@ -24,6 +26,16 @@ export default class Page extends Component {
|
||||
this.bodyClass = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* A collections of actions to run when the route changes.
|
||||
* This is extracted here, and not hardcoded in oninit, as oninit is not called
|
||||
* when a different route is handled by the same component, but we still need to
|
||||
* adjust the current route name.
|
||||
*/
|
||||
onNewRoute() {
|
||||
app.current.set('routeName', this.attrs.routeName);
|
||||
}
|
||||
|
||||
oncreate(vnode) {
|
||||
super.oncreate(vnode);
|
||||
|
||||
|
@@ -52,6 +52,7 @@ export default class IndexPage extends Page {
|
||||
|
||||
app.discussions.refreshParams(app.search.params());
|
||||
|
||||
this.onNewRoute();
|
||||
this.currentPath = curPath;
|
||||
|
||||
this.setTitle();
|
||||
|
Reference in New Issue
Block a user