1
0
mirror of https://github.com/flarum/core.git synced 2025-07-22 09:11:19 +02:00

DiscussionPage: call onNewRoute properly

When on a discussion page, the URL changing doesn't always mean we've moved to a different page. In our custom rerender logic, we only want to call `this.onNewRoute()` if the page has actually changed.
This commit is contained in:
Alexander Skvortsov
2020-10-07 16:22:41 -04:00
parent 16cc1e48ef
commit 87c8f60cd4

View File

@@ -100,7 +100,6 @@ export default class DiscussionPage extends Page {
super.onbeforeupdate(vnode); super.onbeforeupdate(vnode);
if (m.route.get() !== this.prevRoute) { if (m.route.get() !== this.prevRoute) {
this.onNewRoute();
this.prevRoute = m.route.get(); this.prevRoute = m.route.get();
// If we have routed to the same discussion as we were viewing previously, // If we have routed to the same discussion as we were viewing previously,
@@ -118,6 +117,7 @@ export default class DiscussionPage extends Page {
this.near = near; this.near = near;
} else { } else {
this.onNewRoute();
this.oninit(vnode); this.oninit(vnode);
} }
} }