diff options
author | Joas Schilling <coding@schilljs.com> | 2021-06-16 08:55:52 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-06-16 08:55:52 +0200 |
commit | 10e241082b106915fe26696dd2cd809a9992cf26 (patch) | |
tree | 7027955260ee8a384ee5f3c58704cb1f02de3bab /src/components/RightSidebar | |
parent | bd4787dfd158a6e34023cb8809f99c7b3cccbfb1 (diff) |
Slow down the participant list update when not visible
There is not a lot use in updating the participant list every 2 seconds,
when the list is not display, the sidebar closed or even the window hidden.
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/components/RightSidebar')
-rw-r--r-- | src/components/RightSidebar/Participants/ParticipantsTab.vue | 24 | ||||
-rw-r--r-- | src/components/RightSidebar/RightSidebar.vue | 1 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index 18fb8626d..dea5e909b 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -86,6 +86,10 @@ export default { type: Boolean, required: true, }, + isActive: { + type: Boolean, + required: true, + }, }, data() { @@ -183,11 +187,27 @@ export default { } }, 250), - debounceUpdateParticipants: debounce(function() { + debounceUpdateParticipants() { + if (!this.$store.getters.windowIsVisible() + || !this.$store.getters.getSidebarStatus + || !this.isActive) { + this.debounceSlowUpdateParticipants() + } + + this.debounceFastUpdateParticipants() + }, + + debounceSlowUpdateParticipants: debounce(function() { + if (!this.fetchingParticipants) { + this.cancelableGetParticipants() + } + }, 15000), + + debounceFastUpdateParticipants: debounce(function() { if (!this.fetchingParticipants) { this.cancelableGetParticipants() } - }, 2000), + }, 3000), async fetchSearchResults() { try { diff --git a/src/components/RightSidebar/RightSidebar.vue b/src/components/RightSidebar/RightSidebar.vue index 2313beac1..acf8579b6 100644 --- a/src/components/RightSidebar/RightSidebar.vue +++ b/src/components/RightSidebar/RightSidebar.vue @@ -52,6 +52,7 @@ :name="t('spreed', 'Participants')" icon="icon-contacts-dark"> <ParticipantsTab + :is-active="activeTab === 'participants'" :can-search="canSearchParticipants" :can-add="canAddParticipants" /> </AppSidebarTab> |