mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: don't refresh notifications in a tight loop
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user