mirror of
https://github.com/flarum/core.git
synced 2025-07-19 15:51:16 +02:00
Make header and navigation components redraw after page components (#2390)
Make header and navigation components redraw after page components. Page components manipulate the header (state), but the header redraws before the page on route change. By changing the mount order, we change also the redraw order.
This commit is contained in:
@@ -27,20 +27,19 @@ export default class AdminApplication extends Application {
|
|||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
mount() {
|
mount() {
|
||||||
m.mount(document.getElementById('app-navigation'), { view: () => Navigation.component({ className: 'App-backControl', drawer: true }) });
|
|
||||||
m.mount(document.getElementById('header-navigation'), Navigation);
|
|
||||||
m.mount(document.getElementById('header-primary'), HeaderPrimary);
|
|
||||||
m.mount(document.getElementById('header-secondary'), HeaderSecondary);
|
|
||||||
m.mount(document.getElementById('admin-navigation'), AdminNav);
|
|
||||||
|
|
||||||
// Mithril does not render the home route on https://example.com/admin, so
|
// Mithril does not render the home route on https://example.com/admin, so
|
||||||
// we need to go to https://example.com/admin#/ explicitly.
|
// we need to go to https://example.com/admin#/ explicitly.
|
||||||
if (!document.location.hash) document.location.hash = '#/';
|
if (!document.location.hash) document.location.hash = '#/';
|
||||||
|
|
||||||
m.route.prefix = '#';
|
m.route.prefix = '#';
|
||||||
|
|
||||||
super.mount();
|
super.mount();
|
||||||
|
|
||||||
|
m.mount(document.getElementById('app-navigation'), { view: () => Navigation.component({ className: 'App-backControl', drawer: true }) });
|
||||||
|
m.mount(document.getElementById('header-navigation'), Navigation);
|
||||||
|
m.mount(document.getElementById('header-primary'), HeaderPrimary);
|
||||||
|
m.mount(document.getElementById('header-secondary'), HeaderSecondary);
|
||||||
|
m.mount(document.getElementById('admin-navigation'), AdminNav);
|
||||||
|
|
||||||
// If an extension has just been enabled, then we will run its settings
|
// If an extension has just been enabled, then we will run its settings
|
||||||
// callback.
|
// callback.
|
||||||
const enabled = localStorage.getItem('enabledExtension');
|
const enabled = localStorage.getItem('enabledExtension');
|
||||||
|
@@ -115,17 +115,19 @@ export default class ForumApplication extends Application {
|
|||||||
this.routes[defaultAction].path = '/';
|
this.routes[defaultAction].path = '/';
|
||||||
this.history.push(defaultAction, this.translator.trans('core.forum.header.back_to_index_tooltip'), '/');
|
this.history.push(defaultAction, this.translator.trans('core.forum.header.back_to_index_tooltip'), '/');
|
||||||
|
|
||||||
|
this.pane = new Pane(document.getElementById('app'));
|
||||||
|
|
||||||
|
m.route.prefix = '';
|
||||||
|
super.mount(this.forum.attribute('basePath'));
|
||||||
|
|
||||||
|
// We mount navigation and header components after the page, so components
|
||||||
|
// like the back button can access the updated state when rendering.
|
||||||
m.mount(document.getElementById('app-navigation'), { view: () => Navigation.component({ className: 'App-backControl', drawer: true }) });
|
m.mount(document.getElementById('app-navigation'), { view: () => Navigation.component({ className: 'App-backControl', drawer: true }) });
|
||||||
m.mount(document.getElementById('header-navigation'), Navigation);
|
m.mount(document.getElementById('header-navigation'), Navigation);
|
||||||
m.mount(document.getElementById('header-primary'), HeaderPrimary);
|
m.mount(document.getElementById('header-primary'), HeaderPrimary);
|
||||||
m.mount(document.getElementById('header-secondary'), HeaderSecondary);
|
m.mount(document.getElementById('header-secondary'), HeaderSecondary);
|
||||||
m.mount(document.getElementById('composer'), { view: () => Composer.component({ state: this.composer }) });
|
m.mount(document.getElementById('composer'), { view: () => Composer.component({ state: this.composer }) });
|
||||||
|
|
||||||
this.pane = new Pane(document.getElementById('app'));
|
|
||||||
|
|
||||||
m.route.prefix = '';
|
|
||||||
super.mount(this.forum.attribute('basePath'));
|
|
||||||
|
|
||||||
alertEmailConfirmation(this);
|
alertEmailConfirmation(this);
|
||||||
|
|
||||||
// Route the home link back home when clicked. We do not want it to register
|
// Route the home link back home when clicked. We do not want it to register
|
||||||
|
Reference in New Issue
Block a user