1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 08:24:28 +02:00

Fix lifecyle method workarounds (#2378)

Essentially, whenever a route is loaded, we add a key to that component. If the key changes, the page completely rerenders. Switching between different routes handled by the same key triggers those rerenders.
This commit is contained in:
Wadim Kalmykov
2020-10-16 04:40:25 +07:00
committed by GitHub
parent eb498a0a9f
commit 78be6e2194
5 changed files with 9 additions and 84 deletions

View File

@@ -42,26 +42,6 @@ export default class IndexPage extends Page {
app.history.push('index', app.translator.trans('core.forum.header.back_to_index_tooltip'));
this.bodyClass = 'App--index';
this.currentPath = m.route.get();
}
onbeforeupdate(vnode) {
super.onbeforeupdate(vnode);
const curPath = m.route.get();
if (this.currentPath !== curPath) {
this.onNewRoute();
app.discussions.clear();
app.discussions.refreshParams(app.search.params());
this.currentPath = curPath;
this.setTitle();
}
}
view() {