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',
|
buildKey: () => 'user-notifications',
|
||||||
|
|
||||||
defaultState() {
|
defaultState() {
|
||||||
return { notifications: [], loading: false };
|
return { notifications: [], loading: false, loaded: false };
|
||||||
},
|
},
|
||||||
|
|
||||||
notificationsChanged() {
|
notificationsChanged() {
|
||||||
|
@ -49,12 +49,13 @@ export default createWidget('user-notifications', {
|
||||||
state.notifications = [];
|
state.notifications = [];
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
|
state.loaded = true;
|
||||||
this.scheduleRerender();
|
this.scheduleRerender();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
html(attrs, state) {
|
html(attrs, state) {
|
||||||
if (!state.notifications.length) {
|
if (!state.loaded) {
|
||||||
this.refreshNotifications(state);
|
this.refreshNotifications(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue