diff --git a/app/javascript/vue/navigation/top_menu.vue b/app/javascript/vue/navigation/top_menu.vue index f83aa7aa3..14be00683 100644 --- a/app/javascript/vue/navigation/top_menu.vue +++ b/app/javascript/vue/navigation/top_menu.vue @@ -126,6 +126,9 @@ // Track name update in user profile settings $(document).on('inlineEditing::updated', '.inline-editing-container[data-field-to-update="full_name"]', this.fetchData); }, + beforeDestroy: function(){ + clearTimeout(this.unseenNotificationsTimeout); + }, methods: { fetchData() { $.get(this.url, (result) => { @@ -160,8 +163,10 @@ window.open(`${this.searchUrl}?q=${e.target.value}`, '_self') }, checkUnseenNotifications() { + clearTimeout(this.unseenNotificationsTimeout); $.get(this.unseenNotificationsUrl, (result) => { this.unseenNotificationsCount = result.unseen; + this.unseenNotificationsTimeout = setTimeout(this.checkUnseenNotifications, 30000); }) }, refreshCurrentTeam() {