mirror of
https://github.com/flarum/core.git
synced 2025-07-26 11:10:41 +02:00
Minor improvements to onNewRoute (#2328)
- Call onNewRoute when page changed with same component in DiscussionPage and UserPage - Make app.previous and app.current changed in onNewRoute, not in oninit. This way, when the route is changed, but still handled by the same component, a new PageState object will still be created.
This commit is contained in:
committed by
GitHub
parent
0b3fe10516
commit
44a96a82ef
@@ -10,9 +10,6 @@ export default class Page extends Component {
|
||||
oninit(vnode) {
|
||||
super.oninit(vnode);
|
||||
|
||||
app.previous = app.current;
|
||||
app.current = new PageState(this.constructor);
|
||||
|
||||
this.onNewRoute();
|
||||
|
||||
app.drawer.hide();
|
||||
@@ -33,7 +30,8 @@ export default class Page extends Component {
|
||||
* adjust the current route name.
|
||||
*/
|
||||
onNewRoute() {
|
||||
app.current.set('routeName', this.attrs.routeName);
|
||||
app.previous = app.current;
|
||||
app.current = new PageState(this.constructor, { routeName: this.attrs.routeName });
|
||||
}
|
||||
|
||||
oncreate(vnode) {
|
||||
|
Reference in New Issue
Block a user