FIX: don't refresh notifications in a tight loop
This commit is contained in:
parent
9f0f086b3e
commit
41e7bdff38
|
@ -7,7 +7,7 @@ export default createWidget('user-notifications', {
|
|||
buildKey: () => 'user-notifications',
|
||||
|
||||
defaultState() {
|
||||
return { notifications: [], loading: false };
|
||||
return { notifications: [], loading: false, loaded: false };
|
||||
},
|
||||
|
||||
notificationsChanged() {
|
||||
|
@ -49,12 +49,13 @@ export default createWidget('user-notifications', {
|
|||
state.notifications = [];
|
||||
}).finally(() => {
|
||||
state.loading = false;
|
||||
state.loaded = true;
|
||||
this.scheduleRerender();
|
||||
});
|
||||
},
|
||||
|
||||
html(attrs, state) {
|
||||
if (!state.notifications.length) {
|
||||
if (!state.loaded) {
|
||||
this.refreshNotifications(state);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue