From 41e7bdff38b9ebecfd73b73dd6b7538a77ed952f Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 28 Aug 2017 16:52:00 -0400 Subject: [PATCH] FIX: don't refresh notifications in a tight loop --- .../javascripts/discourse/widgets/user-notifications.js.es6 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 b/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 index 2be1dd832d1..7eaac6f085e 100644 --- a/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/widgets/user-notifications.js.es6 @@ -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); }