mirror of
https://github.com/flarum/core.git
synced 2025-10-22 20:26:15 +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
@@ -99,6 +99,7 @@ export default class DiscussionPage extends Page {
|
||||
super.onbeforeupdate(vnode);
|
||||
|
||||
if (m.route.get() !== this.prevRoute) {
|
||||
this.onNewRoute();
|
||||
this.prevRoute = m.route.get();
|
||||
|
||||
// If we have routed to the same discussion as we were viewing previously,
|
||||
|
@@ -34,6 +34,8 @@ export default class UserPage extends Page {
|
||||
onbeforeupdate() {
|
||||
const currUsername = m.route.param('username');
|
||||
if (currUsername !== this.prevUsername) {
|
||||
this.onNewRoute();
|
||||
|
||||
this.prevUsername = currUsername;
|
||||
|
||||
this.loadUser(currUsername);
|
||||
|
Reference in New Issue
Block a user