mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 00:46:09 +08:00
Refactor notification list loading
So that notifications are reloaded (if needed) every time the notifications dropdown button is clicked
This commit is contained in:
parent
eee34598f1
commit
c74b3434e7
@ -18,8 +18,6 @@ export default class NotificationList extends Component {
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.loading = false;
|
||||
|
||||
this.load();
|
||||
}
|
||||
|
||||
view() {
|
||||
|
@ -12,6 +12,8 @@ export default class NotificationsDropdown extends Component {
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.showing = false;
|
||||
|
||||
this.list = new NotificationList();
|
||||
}
|
||||
|
||||
view() {
|
||||
@ -28,7 +30,7 @@ export default class NotificationsDropdown extends Component {
|
||||
<span className="Button-label">{app.trans('core.notifications')}</span>
|
||||
</a>
|
||||
<div className="Dropdown-menu Dropdown-menu--right" onclick={this.menuClick.bind(this)}>
|
||||
{this.showing ? NotificationList.component() : ''}
|
||||
{this.showing ? this.list.render() : ''}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@ -39,6 +41,7 @@ export default class NotificationsDropdown extends Component {
|
||||
m.route(app.route('notifications'));
|
||||
} else {
|
||||
this.showing = true;
|
||||
this.list.load();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,12 @@ export default class NotificationsPage extends Component {
|
||||
app.history.push('notifications');
|
||||
app.drawer.hide();
|
||||
app.modal.close();
|
||||
|
||||
this.list = new NotificationList();
|
||||
this.list.load();
|
||||
}
|
||||
|
||||
view() {
|
||||
return <div className="NotificationsPage">{NotificationList.component()}</div>;
|
||||
return <div className="NotificationsPage">{this.list.render()}</div>;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user