summaryrefslogtreecommitdiffstats
path: root/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-05-12 16:22:11 +0200
committerJoas Schilling <coding@schilljs.com>2020-05-12 19:12:39 +0200
commit19b5df08878e73c13af50549d0efe294639229db (patch)
treec441745045755b0f43e5896243bff58f29f286df /src/components/LeftSidebar/ConversationsList/ConversationsList.vue
parent2178a65db64fd09b037b4bb9999b3e0f3ea06ca6 (diff)
Debounce the refreshing of the room list from signaling by 3 seconds
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/components/LeftSidebar/ConversationsList/ConversationsList.vue')
-rw-r--r--src/components/LeftSidebar/ConversationsList/ConversationsList.vue10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
index de95ad487..4c38da383 100644
--- a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
+++ b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue
@@ -91,11 +91,11 @@ export default {
}, 30000)
EventBus.$on('routeChange', this.onRouteChange)
- EventBus.$on('shouldRefreshConversations', this.fetchConversations)
+ EventBus.$on('shouldRefreshConversations', this.debounceFetchConversations)
},
beforeDestroy() {
EventBus.$off('routeChange', this.onRouteChange)
- EventBus.$off('shouldRefreshConversations', this.fetchConversations)
+ EventBus.$off('shouldRefreshConversations', this.debounceFetchConversations)
},
methods: {
onRouteChange({ from, to }) {
@@ -115,6 +115,12 @@ export default {
return conversation2.lastActivity - conversation1.lastActivity
},
+ debounceFetchConversations: debounce(function() {
+ if (!this.isFetchingConversations) {
+ this.fetchConversations()
+ }
+ }, 3000),
+
async fetchConversations() {
this.isFetchingConversations = true